I have a program that uses a light sensor that converts light to pulses. I have it connected to PIn2 of a UNO and used attachinterrupt during setup to activate the pulse counting on that pin.
attachInterrupt(0, pulsecnt , RISING);
The pulsecnt function only increments a counter:
void pulsecnt(){
cnt++;
}
However I noticed that for some reason, after I use the attachinterrupt function, millis() stop working, and pulse counting continues as it should. But the strange thing is that this behaviour is not constant, sometimes it works, sometime don't.
The code is very extense and full of libs, so I won't copy it here.
Is it possible that the pulse counting on PIN2 is interfeering with the millis() function??
Ok. I think you need to look through your code very carefully to work out what you've done wrong. Maybe a semi colon on the end of an IF statement, or a single '=' where a double belongs. But we can only guess.