/*
Controlling a servo position using a potentiometer (variable resistor)
by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>
modified on 8 Nov 2013
by Scott Fitzgerald
http://www.arduino.cc/en/Tutorial/Knob
*/
#include <Servo.h>
Servo myservo1;
Servo myservo2;
// create servo object to control a servo
int potpinA0 = 0;
int potpinA4 = 4;
// analog pin used to connect the potentiometer
int val0;
int val4;
// variable to read the value from the analog pin
void setup() {
myservo1.attach(9);
myservo2.attach(10);
}
void stepexam () {
val4=analogRead(potpinA4);
val4=map(val4,0,1023,0,180);
myservo1.write(val4);
val0 = analogRead (potpinA0) ;
val0 = map (val0, 0, 1023, 0, 180);
myservo2.write (val0);
delay (15);
}
void loop() {
stepexam(); }
/*void stepexam () {
val = analogRead (potpin);
val = map (val, 0, 1023, 0, 180);
myservo.write (val);
delay (15);} */