This project will show you how to connect a Grove Thumb Joystick to your Arduino so that you can use it for any project where you’ll need some joystick control.

 

1. Assemble the project

  • Connect the cable that came with the Grove Thumb Joystick to the joystick’s connector.

grove-connection

  • Look at the underside of the joystick’s board to identify what the 4 cables correspond to.

grove-thumb-reverse

  • Connect a jumper wire from GND on the Grove to GND on the Arduino.
  • Connect a jumper wire from VCC on the Grove to 3.3V on the Arduino.
  • Connect a jumper wire from X on the Grove to A0 on the Arduino.
  • Connect a jumper wire from Y on the Grove to A1 on the Arduino.

arduino-grove-thumb

 

2. Programme the Arduino

Get Arduino IDE

  • Connect the Arduino to your host computer using a micro USB cable.
  • Open Arduino IDE, set the correct options for Board (Arduino Leonardo) and Port (USB)under the Tools menu.
  • Upload the following code:
void setup() {  Serial.begin(9600);
}
 
void loop() {
  int sensorValue1 = analogRead(A0);
  int sensorValue2 = analogRead(A1);
  Serial.print("The X and Y coordinate is:");
  Serial.print(sensorValue1, DEC);
  Serial.print(",");
  Serial.println(sensorValue2, DEC);
  Serial.println(" ");
  delay(200);
}​
  • Open the Serial Monitor by clicking on the Magnifying glass icon on the Arduino IDE window.

You should now see the X and Y values change as you move the Grove joystick.

serial monitor

 

 

3. Do more

Now that you have the basic set-up up and running you can easily incorporate the X and Y values received by the Arduino to any project where you need control. Simply use the variables sensorValue1 and sensorValue2 in your code.

 

Like what you read? Why not show your appreciation by giving some love.

From a quick tap to smashing that love button and show how much you enjoyed this project.

Privacy

Our website uses cookies and similar technologies to provide you with a better service while searching or placing an order, for analytical purposes and to personalise our advertising. You can change your cookie settings by reading our cookie policy. Otherwise, we’ll assume you’re OK with our use of cookies.

Location

Please select an option to see content specific to your location and shop online.

Browse the US site