The two parameters of the pulse Set Servo Position block are servo channel and
target position. In the example, pulse Set Servo Position means Servo 1 will rotate
to the target position of 180°. It then changes position to 0° but continues at the
same speed.
This servo will continue to change position because the program will continue to
execute the loop until the program is ended (Figure 36).
In the sketch, both blocks work together to tell the servo motor not only the target
position but also the speed to use while moving to the target position.
You can alter the position and speed of the servo by changing the values of both
functions. Practice changing the parameters in the sketch. Observe the effect these
changes have on the servo motor.
Extension Activity
With the example as a reference, try creating a new sketch to move your servo
motor. You could also incorporate the use of your DC motor and LEDs on the
controller. Remember what you learned from your previous activities and think of
creative ways to combine the functions you have learned.
Figure 36
Tip: To solve this
extension activity, you
can find a sample sketch
in the appendix titled
GS_Activity_3_Extension_
Example.
Getting Started Activities 35