Description
- Push button
- One 10k resistor for each axis
- Works with 5 volts
- Standard male pins out
This joystick has two 10K potentiometers and a switch. It works with 5V and the breakout board has a 5 pin male header for easy connection.
Use it to mix your RGB LED color, program your robocar, move your gantry… the possibilities are endless.
Supply voltage | +5 VDC |
Outputs | Two analog signals, one digital signal |
Connections | VCC, ground, X axis, Y axis and key |






Easy to connect, with only five cables. You can pin the module on the breadboard and use the male to male jumper cables, or use the male to female jumper cables to connect the module directly to the Arduino-compatible board.
Supply voltage to the board connecting the +5v pin to the 5v power pin and the GND pin to the GND pin. For our example, connect VRy to analog 0 (A0) and VRx to analog 1 (A1). Connect SW to digital 2 (D2). Activate in your Arduino-compatible board the internal pull-up for D2.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647/*Rewieved by Dr. Mangus for MangoLabs
Joystick example with serial monitor data visualisation
This example code is in the public domain.
based on a sketch by
Stan
*/
int
xPin = A1;
int
yPin = A0;
int
buttonPin = 2;
int
xPosition = 0;
int
yPosition = 0;
int
buttonState = 0;
void
setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
pinMode(xPin, INPUT);
pinMode(yPin, INPUT);
//activate pull-up resistor on the push-button pin
pinMode(buttonPin, INPUT_PULLUP);
// For versions prior to Arduino 1.0.1
// pinMode(buttonPin, INPUT);
// digitalWrite(buttonPin, HIGH);
}
void
loop() {
xPosition = analogRead(xPin);
yPosition = analogRead(yPin);
buttonState = digitalRead(buttonPin);
Serial.print(
"X: "
);
Serial.print(xPosition);
Serial.print(
" | Y: "
);
Serial.print(yPosition);
Serial.print(
" | Button: "
);
Serial.println(buttonState);
delay(100);
// add some delay between reads
}
- In this example we are connecting:
Arduino Joystick
A0 — VRy
A1 — VRx
D2 — SW
GND — GND
5V — +5V - Download and install the Arduino environment from here or use the web editor.
- Download the sketch here and open, or open the Arduino environment and copy the code into a blank sketch.
- Connect your board to your computer with the included USB cable.
- Select your board in Tools / Board / Arduino Uno.
- Select your port in Tools / Port / COM# (Arduino Uno). This may be slightly different depending on your operating system.
- Upload by pressing the arrow in the circle to the upper left.
- To open the serial monitor, press the magnifying glass icon on the upper right.
- Set the baud rate to 9600 on the lower right.
- Move your joystick. You should see a text indicating the position of each axis and a message if you press on it.That’s it!