Hello guys,
I am relatively new to the arduino IDE so please don't be to harsh if it is an obvious mistake.
At the moment I am working with and ESP32 and i am using the Arduino-IDE to program it.
I am trying to generate an interrupt whenever a button is pressed, so that i make sure the button is read in even if i my loop would take a long time. For the interrupt I found attachInterrupt(25, Taster_links_gedruekt, FALLING); which reads in the pin 25 and when it detects a falling edge (button pressed) it calls the function Taster_links_gedruekt.
because of the bouncing of the button I thought it would be an good idea to use an delay function so that the code afterwards will not get executed several times. However this does not really work.
here is the Code i used for testing:
int counter = 0;
void Taster_links_gedruekt() {
delay(1000);
counter ++;
// Serial.println(" links__ " + counter);
Serial.println("12345678987654321 Counter:" + counter);
delay(10);
// timer.disableTimer_Taster_links();
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(25, INPUT);
delay(100);
attachInterrupt(25, Taster_links_gedruekt, FALLING);
}
void loop() {
// put your main code here, to run repeatedly:
}
and this is the result i get when pressing the button several times in a shot time frame (higher frequency than 1 Hz):
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun 8 2016 00:22:57
rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:10944
load:0x40080400,len:6388
entry 0x400806b4
2345678987654321 Counter:
345678987654321 Counter:
45678987654321 Counter:
5678987654321 Counter:
678987654321 Counter:
78987654321 Counter:
8987654321 Counter:
987654321 Counter:
87654321 Counter:
7654321 Counter:
654321 Counter:
54321 Counter:
4321 Counter:
321 Counter:
21 Counter:
1 Counter:
Counter:
Counter:
ounter:
unter:
nter:
ter:
er:
r:
:
Any following press of the button does not result in anything (edit: actually it does. After a few empty lines it prints out some voodo shit.
does someone know what is happening here?
edit: The Delay does not appear to do anything. I connected an LED to an Port which I would set on high after the delay u can see above put the LED turns on instantly.
