Hello.!!
In my project i am trying to read the only one data from sensor when button is pressed( button in interrupt mode.)
But problem is that, when i press the the button interrupt function(ISR) getting called more than once. i uses delayMicoseconds() (i know it is not recommended) to stop bouncing but still it is getting called. i also go through debouce example, but i guess millis() is not allowed in ISR.
how can i stop ISR to get called more than once. ?
how can i stop ISR to get called more than once. ?
Quit using interrupts. There is NOTHING about reading a slow mechanical switch that requires interrupts.
If you insist, anyway, what YOU need to do is ignore calls to the ISR that happen too close to the last (valid) call. That does NOT mean using any kind of delay(). It means that you you record when the interrupt happens, and compare now (when it happens again) to then, to determine if you care about this interrupt.
hello !!
I stuck in a new problem..
i am using both External interrupts (0,1) of UNO with switches. also i am using IRRemote library to send the HEX code using IR LED.But, I am not able to send hex code using IR LED because IR led is also connected at digital pin no 3 (with interrupt 1). I also tried to change the led pin number 3 to 10 in IRremote.cpp(inside enableIROut()) but still i am not able to send IR code..
when i need to send the HEX code i use detachInterrupt() and after sending data again attachInterrupt(). can i do by this way?
how can i send hex code using IR LED??
i also go through debouce example, but i guess millis() is not allowed in ISR.
You can use millis() inside a ISR however the value of the returned value from millis() will not increment while inside the ISR (because all interrupts are disabled while inside a ISR) so it's only useful to find the 'time' that the interrupt was generated.