
223Chapter 8: Actuators
Servo mrSpinny
This declares a variable name for the particular servo you are working with.
In this case, it is mrSpinny. But it could be myFavoriteServo, servo, or
even Bob. You’ll see in the following commands that it is mrSpinny followed
by a period followed by the command mrSpinny would be replaced with
whatever variable you’ve declared.
mrSpinny.attach(pin)
This declares which pin the servo will be connected to.
mrSpinny.write(angle)
The angle is the position between 0 and 180 you would like the servo to
turn to. Keep in mind that it takes time for the servo to turn, so you should
always include a delay between .write ...