void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(A2, INPUT);
pinMode(A1, INPUT);
pinMode(D5, INPUT);
pinMode(D7, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int VX = analogRead(A2);
int VY = analogRead(A1);
int button_state = digitalRead(D5);
if(VX >= 2048) VX = map(VX, 2048, 4095, 0, 1);
else if(VX < 2048) VX = map(VX, 0, 2048, -1, 0);
Serial.print(VX);
Serial.print(" ");
Serial.println(!button_state);
delay(50);
}