Grove Thumb Joystick

by ThisIsSteve in Circuits > Arduino

3251 Views, 11 Favorites, 0 Comments

Grove Thumb Joystick

1.jpg
2.jpg

This is part three of a series of instructables where I take standard Grove senors and components and wire it up with a Arduino. In the last two tutorials I showed how to connect an I2C motor driver and a single axis analog Gyro to the Arduino, be sure to check that out. These tutorials are a part of a robot project using all of these sensors.

In this instructable I'm going to show you how to connect a Grove Thumb Joystick to the Arduino.

So lets get started.....

Tools and Components

3.jpg

All that you need for this instructable is -

  • Arduino UNO
  • Grove Thumb Joystick
  • Jumper Wires

Note- No soldering skills are required to build this project, but it is good to know how to solder there are a good soldering tutorials on YouTube that can help you get started.

Hardware

Time to connect the Arduino to the Grove Thumb Stick, the connections goes as follows -

  • Arduino +5V - Grove Thumb Joystick VCC
  • Arduino Gnd - Grove analog Joystick Gnd
  • Arduino A0 - Grove analog Joystick X axis
  • Arduino A1 - Grove analog Joystick Y axis

After getting the hardware connected, it is time to upload the code...

Code

All that the code does is reads the analog value and does some mathematics and prints it out on a serial monitor. The processed data can be used to control a robot which I will show soon.

<br><p>void setup() {<br>  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);
}</p>