Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Servo.h>
- Servo servo1;
- Servo servo2;
- int joyX = 0;
- int joyY = 1;
- int servoVal1,servoVal2;
- void setup()
- {
- Serial.begin(9600);
- servo1.attach(10);
- servo2.attach(9);
- }
- void loop()
- {
- servoVal1 = analogRead(joyX);
- servoVal1 = map(servoVal1, 0, 1023, 0, 180);
- servo1.write(servoVal1);
- servoVal2 = analogRead(joyY);
- servoVal2 = map(servoVal2, 0, 1023, 0, 180);
- servo2.write(servoVal2);
- Serial.println(servoVal2);
- delay(15);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement