DUAL AXIS JOYSTICK
- analog dual-axis joystick with cap
- power voltage: 3.3 - 5V DC
- dimension: 34 x 26 mm
- height: 32 mm
- two integrated bi-directional 10K resistors
- integrated push-button
- easy to use with Arduino
Arduino code:
int Joystick_X = 0; // x axle int Joystick_Y = 1; // y axle int Joystick_Z = 3; // push-button
void setup () { pinMode(Joystick_X, INPUT); pinMode(Joystick_Y, INPUT); pinMode(Joystick_Z, INPUT); Serial.begin(9600); }
void loop () {
int x = analogRead(Joystick_X); // read x axle int y = analogRead(Joystick_Y); // read y axle int z = digitalRead(Joystick_Z); // read button status
Serial.print(x, DEC); Serial.print( ","); Serial.print(y, DEC); Serial.print( ","); Serial.println(z, DEC); }
