ARDUINO EVERY - TIMER INTERRUPTS

dear Peter,

The Nano Every has a ATMEGA4809 processor that has different timer counters than the ATmega328P of the Uno, Mega en Nano boards.

I wrote a small library that implements control of the Timer B (TCB) of the Nano Every.
You can find it here:

Copy the EveryTimerB.h/cpp and MegaAvr20MHz.h files to your sketch folder and add this code:

#include "EveryTimerB.h".

void setup() {
TimerB0.initialize();
TimerB0.attachInterrupt(myisr);
TimerB0.setPeriod(1000000);
}

void myisr() {
// do something useful every second
}

1 Like