User Manual
31
Here we use two variables to control the angle the servo rotates to and the port it connects
to.
Add a repeat until block to make a loop assign values for the angle of the 8 servos (or less)
connected to pwm0-pwm7 ports. This program will run the code in the block in a loop till the
condition is met (that is, the requirement in the red frame below is met). Here it is when the
value of the number variable is larger than 7.
Drag another repeat until block to assign angle values from 0 to 180 degrees to the servos,
with a gap of 5 degrees for each.
Drag one more repeat until block to assign angle values from 180 to 0 degrees to the servos,
also with a gap of 5 degrees for each.
SunFounder