Joystick código para Arduino

 

Les comparto un pequeño código para la elctura del Joystick,

int X=A0;
int Y=A1;
int Z=9;

void setup() {
Serial.begin (9600);
pinMode(Z, INPUT_PULLUP);

}

void loop() {
Serial.print(“X: “);
Serial.print(analogRead(X));
Serial.print(” | Y: “);
Serial.print(analogRead(Y));
Serial.print(” | Z: “);
Serial.println(digitalRead(Z));
delay(500);
}

Leave a Reply

Your email address will not be published. Required fields are marked *