Hello. I am a beginner. Can someone please teach me how I can use this ps2 joystick as a pushbutton? I read in the description that it can be also used as a pushbutton but I do not know how.
Plenty of info on the manufacturer's web site
They basically say that you'll get values between ~200 and ~800 when you perform an analogRead() of the axis and if the button is pressed you'll read ~1023
connect
Arduino | Joystick |
---|---|
5V | Red cable |
GND | Black cable |
A1 | White cable |
A0 | Yellow cable |
run this code
void setup() {
Serial.begin(115200);
}
void loop() {
Serial.print(analogRead(A0));
Serial.write(',');
Serial.println(analogRead(A1));
delay(200);
}
Open the serial monitor at 115200 bauds and look at the (x,y) values when you move the joystick around and when you press.
1 Like
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.