Step 14: Resources

Step 15: FAQs

Frequently asked questions- Do you offer a servo board kit? Nope- at least not yet. I might be coaxed into making a fully assembled board though...j...

Step 9: Controlling servos

Example 5- controlling a servo using analog input

These two examples show how easy it is to control servos using an analog input. You can use any analog input device you want- I'll use a 10k Ohm potentiometer for the example wiring diagram. As you turn the pot (and change its value) the servo moves proportionally.

The second code example simply extends the first example to control six servos from six inputs. This kind of control comes in really handy if you want to control several servos using bend sensors attached to a glove. This would work really well for controlling an animatronic mask.

/* * Example 5 * Servo Control * This example uses a servos and analog input to move the servo according to the sensor input value * Honus 2010 */

#include "Servo.h" // include the servo library

Servo servo1; // creates an instance of the servo object to control a servo

int analogPin = 0; // the analog pin that the sensor is on int analogValue = 0; // the value returned from the analog sensor

void loop() { analogValue = analogRead(analogPin); // read the analog input (value between 0 and 1023) analogValue = map(analogValue, 0, 1023, 0, 179); // map the analog value (0 - 1023) to the angle of the servo (0 - 179) servo1.write(analogValue); // write the new mapped analog value to set the position of the servo delay(15); // waits for the servo to get there }

About This Instructable

Bio:I'm a former bicycle industry designer turned professional jeweler. I like working with my hands and am happiest when I'm in the shop building my creations. If you need help with your project just let...read more »