Microcontrollers have timers, and a timeslice routing can be called each tick.
A way of doing an Automata is to use a countdown timer.
Musical boxes often use a rotating disk and pins pluck a note.
A clock that strikes the hour have a mechanism that is triggered and counts out the dongs.
Each value of Timer
timer1 is a variable.
each timer tick decrement it down to zero
onTimerTick(){
if ( timer1 > 0 ){ timer1 += -1
} if ( timer1 == 10 ){ routine0() } if ( timer1 == 5 ){ routine2() } if ( timer1 == 1 ){ routine2)_ } }
Each timertick execute a line of code.
For each tick decrement by K, and increment by decimal value
Execute the next routing in the list.
Each timertick, jump through a pointer to the handler . The Handler leaves the pointer at the next routine.
onTimerTick() switch ( timer0 ){ 10: routine(); break; 30: routine(); break; 35: routine(); break; }
}
Each timer tick a routine is run and a pointer is set to the routine called next tick.
The state is coded 1 << state | count