The KY-023 Dual Axis Joystick Module is a simple module that includes a joystick for controlling two axes, typically used for interfacing with microcontrollers like Arduino, Raspberry Pi, and other similar platforms. It allows for both horizontal and vertical motion, providing input on two axes, X and Y, and often includes a push button for additional input when the joystick is pressed.
Here are the main features of the KY-023 Dual Axis Joystick Module:
Here’s a simple example of how you might use the KY-023 with an Arduino:
int xPin = A0; // X-axis connected to analog pin A0 int yPin = A1; // Y-axis connected to analog pin A1 int buttonPin = 2; // Button connected to digital pin 2 int xValue = 0; int yValue = 0; int buttonState = 0; void setup() { Serial.begin(9600); pinMode(buttonPin, INPUT); } void loop() { xValue = analogRead(xPin); // Read X-axis yValue = analogRead(yPin); // Read Y-axis buttonState = digitalRead(buttonPin); // Read button press state // Output values to Serial Monitor Serial.print("X: "); Serial.print(xValue); Serial.print(" Y: "); Serial.print(yValue); Serial.print(" Button: "); Serial.println(buttonState); delay(100); // Short delay for readability }
The joystick module might need to be calibrated, depending on your application, to account for any slight offsets in the joystick's resting position. For example, if you want the joystick to rest at the midpoint when idle, you can adjust the values in your code accordingly.
Brand:- Generic
Origin:- China