#include <Servo.h>
Servo xs; //define servoname
Servo ys; //define servoname
int xp = A1; //define poti pins
int yp = A2; //define poti pins
int val;
void setup() {
// put your setup code here, to run once:
xs.attach(10); //servopin define
ys.attach(11); //servopin define
}
void loop() {
// put your main code here, to run repeatedly:
val = analogRead(xp); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
xs.write(val); // sets the servo position according to the scaled value
delay(7.5);
val = analogRead(yp); //read the value of the poti
val = map(val, 0, 1023, 0, 180); //scale it with servo val
ys.write (val); //set servo position according to poti
delay(7.5); //time delay for servo to react
}