Hi!
I'm working with a laser tachometer using an Arduino Uno. When the laser is blocked, digital input 0 reads low, and an interrupt records the time. Like this:
#include <Time.h>
void setup()
{
Serial.begin(9600);
attachInterrupt(0,timestamp, FALLING);
}
void loop()
{
}
void timestamp()
{
Serial.println(millis());
}
The serial port is monitored by a Matlab script which records, processes, and graphs the tachometer data.
This all works fine under normal operation. HOWEVER: when the laser is blocked very gradually and slowly, the arduino seems to get only half of an interrupt and then fails. The result looks like a string of millisecond values with one value at the end that only contains a few of the digits:
13489
13511
13525
135
And then no more values are sent to the serial port until the board is reset.
I read about some software debouncing, but that had no effect on the problem.
Has anyone experienced this or know where the problem might originate?
Thanks for the help