Servo calibration code for the BoeBot. Both servos should remain still. If either is drifting, the potentiometer must be adjusted until the servo stops spinning or humming.
Complete textbook for the BoeBot can be found here.
/*
Robotics with the BOE Shield – BothServosStayStill
Generate signals to make the servos stay still for centering.
*/
#include <Servo.h> // Include servo library
Servo servoLeft; // Declare left servo signal
Servo servoRight; // Declare right servo signal
void setup() // Built in initialization block
{
servoLeft.attach(13); // Attach left signal to pin 13
servoRight.attach(12); // Attach left signal to pin 12
servoLeft.writeMicroseconds(1500); // 1.5 ms stay still sig, pin 13
servoRight.writeMicroseconds(1500); // 1.5 ms stay still sig, pin 12
}
void loop() // Main loop auto-repeats
{ // Empty, nothing needs repeating
}