5D Rocker Joystick For Arduino Mcu Avr Game
Rs. 76.00 Rs. 94.00
- Product Code: SEN-JOYSTICK
- SKU -
- Availability: In Stock
- Price in reward points: 1
- For Bulk Order 9962060070
Quick support on WhatsApp (+919962060070) only between morning 11am-4pm, no call will be answered
SPECIFICATIONS: | |
Operating Voltage (VDC) | 2 ~ 9 |
Operating Temperature Range (°C) | 40 to 85 |
OVERVIEW:
-Supports up/down/left/right/middle with extra set and reset button
-2V-9V wide working voltage
-The number of IO: 7
-Operating temperature: -40℃ to 85℃
PACKAGE INCLUDES:
1 PCS x 5D Rocker Joystick For Arduino Mcu Avr Game
//SOURCE CODE TAKEN FROM BELOW LINK
//https://create.arduino.cc/projecthub/MisterBotBreak/how-to-use-a-joystick-with-serial-monitor-1f04f0
int VRx = A0;
int VRy = A1;
int SW = 2;
int xPosition = 0;
int yPosition = 0;
int SW_state = 0;
int mapX = 0;
int mapY = 0;
void setup() {
Serial.begin(9600);
pinMode(VRx, INPUT);
pinMode(VRy, INPUT);
pinMode(SW, INPUT_PULLUP);
}
void loop() {
xPosition = analogRead(VRx);
yPosition = analogRead(VRy);
SW_state = digitalRead(SW);
mapX = map(xPosition, 0, 1023, -512, 512);
mapY = map(yPosition, 0, 1023, -512, 512);
Serial.print("X: ");
Serial.print(mapX);
Serial.print(" | Y: ");
Serial.print(mapY);
Serial.print(" | Button: ");
Serial.println(SW_state);
delay(100);
}
15 days