How to address the different timers

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
Post Reply
Faxe
Posts: 1
Joined: Mon Jun 07, 2021 11:46 am

How to address the different timers

Post by Faxe » Mon Jun 07, 2021 12:27 pm

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

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: How to address the different timers

Post by Roberthh » Mon Jun 07, 2021 1:28 pm

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.

Post Reply