0

Line Robot - Basic lessons - Servo

We will assume here that You connected servo motors according to the assembly instructions. In that case "lift" servo is connected to pin 18 of MRMS ESP32: Arduino, IMU, eFuse, BT, WiFi, CAN Bus (mrm-esp32). The following program will set first servo's (servo number 0) position to 20°. First servo is "lift" servo.
void RobotLine::loop() {
	if (setup())
		servo(20, 0);
}
Command's format is:
servo(degrees, servoNumber);
degrees takes value between 0 and 360 for this servo model. Servo number 0 is "lift" servo, servo 1 is "catch" servo. If the servo motor is already part of the robot carefully run this program! The problem is that 20° could be a position servo will not be able to reach because of physical restriction. In that case, the servo will continue trying to do so, drawing a big current and straining transmission. It is quite likely that it will break down in the end. Therefore, when You notice that the connected arm hit one end position, and tries to go even further, immediately disconnect power, change the angle to some other value in 0 - 360 interval, and try again.

Task: catch position.

Program the arm to go to position in which it would catch a ball.