Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <Servo.h>
  2. Servo tilt, pan;
  3. int joyX = A0;
  4. int joyY = A1;
  5. int x, y;
  6. void setup() {
  7. tilt.attach(9);
  8.  
  9. pan.attach(10);
  10.  
  11. }
  12. void loop() {
  13. x = joyX;
  14. y = joyY;
  15. x = map(analogRead(joyX), 0, 1023, 900, 2100);
  16. // Scale it to use
  17. // with servo between
  18. // 900 to 2100
  19. // microseconds
  20. y = map(analogRead(joyY), 0, 1023, 900, 2100);
  21. tilt.write(x);
  22. pan.write(y);
  23. delay(15);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement