TOP

Grove - Thumb Joystick

From Wiki 来自痴汉的爱
Jump to: navigation, search

Contents

Introduction

Grove - Thumb Joystick is a Grove compatible module which is very similar to the 'analog' joystick on PS2 (PlayStation 2) controllers. The X and Y axes are two ~10k potentiometers which control 2D movement by generating analog signals. The joystick also has a push button that could be used for special applications. When the module is in working mode, it will output two analog values, representing two directions.Compared to a normal joystick, its output values are restricted to a smaller range (i.e. 200~800), only when being pressed that the X value will be set to 1023 and the MCU can detect the action of pressing.
Model: COM90133P

Bgjoy1.jpg

Features

  • Grove Interface
  • 5V/3.3V Compatible
  • Analog Output

Application Ideas

  • Game Controller
  • Robot remote

Specifications

Item Min Typical Max Unit
Working Voltage 4.75 5.0 5.25 V
Output Analog Value (X coordinate) 206 516 798 \
Output Analog Value (Y coordinate) 203 507 797 \

Usage

The Grove - Thumb Joystick is an analog device that outputs analog signal ranging from 0 to 1023. That requires us to use the analog port of Arduino to take the readings.

1. Connect the module to the A0/A1 of Grove - Basic Shield using the 4-pin grove cable.
2. Plug the Grove - Basic Shield into Arduino.
3. Connect Arduino to PC by using a USB cable.
Grove-Thumb Joystick.jpg
4. Copy and paste code below to a new Arduino sketch. Please click here if you do not know how to upload.

/*
  Thumb Joystick demo v1.0
by:http://www.seeedstudio.com
 connec the module to A0&A1 for using;
 */
 
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);
}

5. You can check the values of the output analog signals by opening the Serial Monitor.


Grove - Thumd Joystick Result.jpg

The output value from the analog port of Arduino can be converted to the corresponding resistance using the formula:R=(float)(1023-sensorValue)*10/sensorValue.

Resources

Grove-Thumb Joystick Eagle File

Support

Ask questions on Seeed Forum.

Personal tools
Namespaces

Variants
Actions
Navigation
Support
Navigation
Collections
Toolbox