Ah, yes. That's it. It takes multiple passes of loop to "burn off" the accumulated microseconds since initialization of global variables prior to execution of setup().
Another "fix" is to define...
Type: Posts; User: joepasquariello
Ah, yes. That's it. It takes multiple passes of loop to "burn off" the accumulated microseconds since initialization of global variables prior to execution of setup().
Another "fix" is to define...
I can't explain it yet, but initializing g_rising_edge_timer at the end of setup() does fix the problem. I'm using Arduino 1 IDE, TD 1.58b3. Try it.
#include <Arduino.h>
const uint8_t...
You're right, the symptom doesn't match the logic of the fix, but I'd still do it, just to be eliminate any uncertainty in conditions on first execution of loop(). After that, I would use...
Thanks, luni. Good to know. I still think he should add the initialization of g_rising_edge_timer before leaving setup(), just to be sure that the conditions on first pass through loop() are he same...
Try defining your output pin using a macro instead of a variable, which will allow the inline function digitalWriteFast() to do more optimization, and add these two lines after call to pinMode() in...