- 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.
/*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
xPin = A1;
yPin = A0;
buttonPin = 2;
xPosition = 0;
yPosition = 0;
buttonState = 0;
// initialize serial communications at 9600 bps:
//activate pull-up resistor on the push-button pin
// For versions prior to Arduino 1.0.1
// pinMode(buttonPin, INPUT);
// digitalWrite(buttonPin, HIGH);
xPosition = analogRead(xPin);
yPosition = analogRead(yPin);
buttonState = digitalRead(buttonPin);
" | Y: "
" | Button: "
// add some delay between reads
- In this example we are connecting:
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!