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(button_state == !1){
digitalWrite(D7, HIGH);
}else{
digitalWrite(D7, LOW);
}
Serial.print(VX);
Serial.print(" ");
Serial.print(VY);
Serial.print(" ");
Serial.println(!button_state);
delay(50);
}
esp:D0
esp:D1
esp:D2
esp:D3
esp:D4
esp:D5
esp:D6
esp:D7
esp:D8
esp:D9
esp:D10
esp:3V3
esp:GND
esp:5V
r3:1
r3:2
joystick1:VCC
joystick1:VERT
joystick1:HORZ
joystick1:SEL
joystick1:GND