5,710
edits
Changes
→Moving a Servo
// turning the knob turns the servo
// Robert Twomey - roberttwomey.com
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
int a_in = 0; // analog in pin
int val = 0; // variable to store analog value
int pos = 0; // variable to store the servo position
int delay_time = 15;
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop()