Skip to content

ketrab2004-Arduino/Servo_with_joystick

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Servo with Joystick

Image of 2 servos attached with long wires to an Arduino out of frame. And a joystick attached with even longer wires to the same Arduino.

Parts:

  • 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)

Setup:

  1. Attach the joystick
    1. VCC to 5v
    2. GND to ground
    3. HOR to an analogue input (default is 0)
    4. VER to an analogue input (default is 1)
  2. Connect the servos
    1. red to 5v
    2. black/brown to ground
    3. yellow/orange
      • X-axis/horizontal into a digital input (default is 4)
      • Y-axis/vertical into a digital input (default is 3)
  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
  4. Upload the program
  5. Control the servos :)

Fritzing Sketch:

A Fritzing sketch exported to a png. Showing orange wires for the horizontal servo and red for the vertical servo.