ghi-electronics / micropython

A MicroPython port to GHI Electronics SITCore SC13xxx line of products.
https://micropython.org
MIT License
0 stars 0 forks source link

Can't use Timer #19

Open bauland opened 3 years ago

bauland commented 3 years ago

With microPython 0.2:

# testLEDDimming with SC13048Q dev
from machine import Pin, Timer
import time

p = Pin('PA8') # PA8 has TIM1, CH1
tim = machine.Timer(1, freq=4000)
ch = tim.channel(1, Timer.PWM, pin=p)
ch.pulse_width_percent(50)
for d in range(100, 0.1):
    ch.pulse_width_percent(d)
    time.sleep(0.01)

Error on line: tim = machine.Timer(1, freq=4000)

Error message: Traceback (most recent call last): File "", line 1, in ValueError: Timer doesn't exist

I tried with and without machine in front of Timer but nothing. Timer seems implemented because in Thonny autocompletion shows Timer.