Hi,
>>> from machine import Pin
>>> from machine import Timer
>>>
>>> tim = Timer(1, mode=Timer.PERIODIC)
>>> tim_a = tim.channel(Timer.A, freq=4)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid argument(s) value
>>> tim_a = tim.channel(Timer.A, freq=5)
>>>
So, it's impossible to set frequency to a number lower than 5 (Hz). Is that really a feature?
Docs:
https://github.com/micropython/micropyt ... imer-class
Timer frequency minimum is 5 Hz?
Re: Timer frequency minimum is 5 Hz?
I'm not familiar with the HW, but it may just be a limitation due to the source frequency, prescaler, and timer width.
- danicampora
- Posts: 342
- Joined: Tue Sep 30, 2014 7:20 am
- Contact:
Re: Timer frequency minimum is 5 Hz?
Probably the timer width need to be set to 32 bit. I am working on the docs, will push later today. BTW, timers, are not fully tested because that part of the API wasn't clear yet, so don't expect everything to work there. It sucks, I know, hope to address it soon.
Re: Timer frequency minimum is 5 Hz?
No prob. I'll use sleep in the meantime...