You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's recommended that you don't use Timer0 on the ATmega 328 boards because Timer0 is used for the delay() and delayMicroseconds() and I think the millis() and micros() as well.
Try using a 'software interrupt' instead. Here's a short example:
unsigned long lastTime;
unsigned long thisTime;
setup(){
lastTime = micros();
}
loop(){
thisTime = micros();
if(thisTime - lastTime > 2000){
lastTime = thisTime;
//goto the read-sensor-and-get-pulse routine
}
// do the other stuff you want to do
}
Hello,
Can someone help me out in implementing the interrupt on Timer0 instead of Timer1 or Timer2.
I have a WiFi module connected to pins 9,10,11 of the Arduino Nano. These pins are fixed on myt PCB and cannot be replaced.
So I am unable to use the WiFi module if I use Timer1 or Timer2 as my WiFi does not work. The WiFi module will send the pulse (BPM) to the cloud.
Can anyone help me out in implementing Timer0 for the code? I do not mind compromising on delay().
The text was updated successfully, but these errors were encountered: