const int ejey = A7; // Analog input pin that the potentiometer is attached to const int ejex = A6; // Analog input pin that the potentiometer is attached to const int boton = 7; // Analog input pin that the potentiometer is attached to void setup() { // initialize serial communications at 9600 bps: Serial.begin(57600); pinMode(boton, INPUT); digitalWrite(boton, HIGH); } void loop() { /* Serial.print("ejex = " ); Serial.print(analogRead(ejex)); Serial.print(", ejey = " ); Serial.print(analogRead(ejey)); Serial.print(", boton = " ); Serial.println(digitalRead(boton)); delay(10); */ if (analogRead(ejey)>700) Serial.print('w'); else if (analogRead(ejey)<300) Serial.print('s'); if (analogRead(ejex)>700) Serial.print('a'); else if (analogRead(ejex)<300) Serial.print('d'); if (((analogRead(ejey)>300)&&(analogRead(ejey)<700))&&((analogRead(ejex)>300)&&(analogRead(ejex)<700))) Serial.print('p'); }