Servo Demonstration In MPIDE, select File > Examples > Servo > Sweep
Increase Angle via Button Push If button pushed, increase position/angle by 1. If angle greater than 180, reset to 0.
Increase Angle via Button Push If button pushed, increase angle and light LED.
Control Angle via Button Pushes One button increases angle. Other decreases angle. Both light LED.
Display Angle in Serial Monitor Must initialize serial line in setup() function: Serial.begin(9600); Must “print a line” in the loop() function: Serial.println(pos, DEC); Must open the “Serial Monitor”:
Servo Control using Analog Signal Obtain “analog” input using analogRead(). Returns value a value between 0 (if pin at ground) and 1023 (if pin at 3.3 V). Voltage at “wiper” can vary between voltages at either end of the potentiometer.