Arduino – Joystick-LINK
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
#include <Servo.h> #define joystickX A4 #define joystickY A5 #define joystickSw A0 Servo myservo; void setup() { myservo.attach(10); } void loop() { myservo.write(map(analogRead(joystickX), 0, 1023, 0, 180)); delay(5); } |