Page 1 of 1

How to address the different timers

Posted: Mon Jun 07, 2021 12:27 pm
by Faxe
Hello,

i'm new to microphyton, but have some experience in programming UC in assembler.

I found that the pico controller has 1 × Timer with 4 alarms

How do i address the 4 possible alarms ?

up to now i only found these general statements

https://docs.micropython.org/en/latest/ ... Timer.html

tim.init(period=100) # periodic with 100ms period
tim.init(mode=Timer.ONE_SHOT, period=1000) # one shot firing after 1000ms

rgds

Faxe

Re: How to address the different timers

Posted: Mon Jun 07, 2021 1:28 pm
by Roberthh
When you create a timer with e.g.

from machine import Timer
tim1=Timer(period=100) # periodic with 100ms period
tim2=Timer(mode=Timer.ONE_SHOT, period=1000) # one shot firing after 1000ms

These objects tim1 and tim2 are the handles for these two newly created timers. As long as you keep the distinct, you can address them separately.