// ENCODER TESTING
int button_pin=5;
volatile boolean result=false ;
volatile unsigned long last_time=0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
pinMode(button_pin, INPUT);
attachInterrupt(button_pin, readButton, FALLING);
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
Serial.println("RESULT_VALUE: "+String(result));
}
void readButton() {
if ((millis()-last_time)>10){
result=!result;
last_time=millis();
}
}