Product |
Shields
| JoyStick Module -Blue Version
JoyStick Module -Blue Version
![](/Images/websites/emartee.com/T210tgXiNcXXXXXXXX_!!94851079.jpg)
![](/Images/websites/emartee.com/T2dJFgXgpbXXXXXXXX_!!94851079.jpg)
![](/Images/websites/emartee.com/T230xgXaBcXXXXXXXX_!!94851079.jpg)
When using, it can connect with Arduino sensor shield,and connect Arduino corresponding pins through Arduino sensor cables. In the example below, the X axes and Y axes are respectively link to the analog input A1 and A0 ,and Z axis is connected to the digital I/O 7 pin.
![](/Images/websites/emartee.com/T242BsXm4XXXXXXXXX_!!94851079.jpg)
The corresponding code shown below :
int sensorPin = 5; int value = 0; void setup() { pinMode(7, OUTPUT); Serial.begin(9600); } void loop() { value = analogRead(0); Serial.print("X:"); Serial.print(value, DEC); value = analogRead(1); Serial.print(" | Y:"); Serial.print(value, DEC); value = digitalRead(7); Serial.print(" | Z: "); Serial.println(value, DEC); delay(100); } Referring Sample Code : int JoyStick_X = 0; //x int JoyStick_Y = 1; //y int JoyStick_Z = 3; //key void setup() { pinMode(JoyStick_X, INPUT); pinMode(JoyStick_Y, INPUT); pinMode(JoyStick_Z, INPUT); Serial.begin(9600); // 9600 bps } void loop() { int x,y,z; x=analogRead(JoyStick_X); y=analogRead(JoyStick_Y); z=digitalRead(JoyStick_Z); Serial.print(x ,DEC); Serial.print(","); Serial.print(y ,DEC); Serial.print(","); Serial.println(z ,DEC); delay(100); }
Categories
Newsletter
Join our newsletter today, to get latest product information and promotion code.
![](/Images/Icons/loading.gif)