View Code? Open in Web Editor
NEW
2 small servos controlled by a joystick
servo_with_joystick's Introduction
- Arduino (an Uno should be enough)
- A joystick
- 2 Servos (small enough that your arduino can power them both without an external power source)
- A breadboard (only if you want to see the wires better)
- Attach the joystick
VCC
to 5v
GND
to ground
HOR
to an analogue input (default is 0)
VER
to an analogue input (default is 1)
- Connect the servos
- red to 5v
- black/brown to ground
- yellow/orange
- X-axis/horizontal into a digital input (default is 4)
- Y-axis/vertical into a digital input (default is 3)
- Change your settings in main.cpp
SERIAL_PRINT
if you would like Serial.print
debug messages
XPINOUT
if you use a different pin for the horizontal servo
YPINOUT
if you use a different pin for the vertical servo
XPININ
if you use a different analogue pin for the horizontal input from the joystick
YPININ
if you use a different analogue pin for the vertical input from the joystick
- Upload the program
- Control the servos :)