This article shows you how to calibrate a continuous rotation servo using NanoPlayBoard. You can use the onboard potentiometer to move a servo to a specific degree.
Inventory
- NanoPlayBoard.
- 9v battery.
- Continuous rotation servo.
- Screwdriver.
Sketch
Upload this sketch on the NanoPlayBoard:
#include <NanoPlayBoard.h>
NanoPlayBoard board;
void setup() {
}
void loop() {
int value = board.potentiometer.scaleTo(0, 180);
board.ledmatrix.printInLandscape(value);
board.servo[1].to(value);
}
The source code of this sketch is available on GitHub.
Set up connections
Step 1
Connect the servo to the NanoPlayBoard using the row of three male pins named as p4
.
Step 2
Connect the battery to the power socket on the NanoPlayBoard.
Calibration process
- Turn the onboard potentiometer until the
90
value is displayed on the led matrix. - The servo should stop when it receives a signal for
90
degrees. If your servo is still rotating you have to use a small Phillips head screwdriver and turn the potentiometer on the continuous rotation servo until it stop.
Video
Resources
- Hobby Servo Tutorial. Sparkfun.