Difference between revisions of "The Use of Joystick Sensor"
From Microduino Wiki
(Changed 1,023 value under 'Output returned' to 1023 for clarity) |
(Major Edits) |
||
Line 5: | Line 5: | ||
==Outline== | ==Outline== | ||
− | Microduino | + | The Microduino Joystick sensor is two analog output devices in one. There are resistors on the X-axis and Y-axis that each output an analog value corresponding to the position of the joystick on that axis. |
+ | This sensor is great for controlling projects, especially ones that move. | ||
==Specification== | ==Specification== | ||
− | *Electrical | + | *Electrical Specifications |
− | **Analog Output | + | **Analog Output Device |
− | **Output | + | **Analog Output: 0-1023 (with Microduino Core modules) |
− | * | + | *Technical Specifications |
− | ** | + | **Analog Output Corresponding to X and Y-axis displacement |
− | * | + | *Dimensions |
− | ** | + | **Switch: 17mm x 17mm |
− | ** | + | **Board: 20mm x 24mm |
− | *Interface | + | *Connection Interface |
− | ** | + | **Pins: Signal 1 (X-Axis), Signal 2 (Y-Axis), VCC (power) and GND (ground) |
− | + | **Must be connected to analog capable ports (A0-A7) | |
[[File:Joystick-line.jpg|center|400px]] | [[File:Joystick-line.jpg|center|400px]] | ||
Line 44: | Line 45: | ||
[[file:mCookie-joystick.JPG|600px|center]] | [[file:mCookie-joystick.JPG|600px|center]] | ||
− | ===Experiment: Detect Analog | + | ===Experiment: Detect Analog Joystick Value === |
*Open Arduino IDE and copy the following code into IDE. | *Open Arduino IDE and copy the following code into IDE. | ||
<source lang="cpp"> | <source lang="cpp"> |
Revision as of 17:58, 15 August 2016
ContentsOutlineThe Microduino Joystick sensor is two analog output devices in one. There are resistors on the X-axis and Y-axis that each output an analog value corresponding to the position of the joystick on that axis. This sensor is great for controlling projects, especially ones that move. Specification
DevelopmentEquipment
Preparation
Experiment: Detect Analog Joystick Value
#define Pin_X A1
#define Pin_Y A0
void setup() {
Serial.begin(9600); //Serial initializing
pinMode(Pin_X,INPUT);
pinMode(Pin_Y,INPUT);
}
void loop() {
int sensorValueX = analogRead(Pin_X); //X-axis input
int sensorValueY = analogRead(Pin_Y); //Y-axis input
Serial.print("ValueX:");
Serial.print(sensorValueX);
Serial.print(",");
Serial.print("ValueY:");
Serial.println(sensorValueY);
delay(100);
}
Program Debugging
Application
Video |