KY-023 DUAL AXIS JOYSTICK MODULE
Short description :
The KY-023 Dual Axis Joystick module uses a biaxial potentiometer to control the X and Y axis.
Working with (Compatible)
Arduino, ESP32, Nodemcu, ESP8266, Raspberry Pi, and ......
ARDUINO IDE CODE
Example description :
Moving the joystick up/down will increase/decrease the values of X and moving the joystick left/right will increase/decrease for values of Y, these values range between 0 and 1023. Push the joystick down to activate the Z-axis button.
int value = 0;
void setup() {
pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(7, INPUT_PULLUP); //set pin 7 as an input and enable the internal pull-up resistor
Serial.begin(9600);
}
void loop() {
value = analogRead(A0); // read X axis value [0..1023]
Serial.print("X:");
Serial.print(value, DEC);
value = analogRead(A1); // read Y axis value [0..1023]
Serial.print(" | Y:");
Serial.print(value, DEC);
value = digitalRead(7); // read Button state [0,1]
Serial.print(" | Button:");
Serial.println(value, DEC);
delay(100);
}