import time #导入时间模块
from pyb import Pin,Timer #导入micropython-pyb文件夹下Pin,Timer模块
p = Pin('PC6') #pc6是单片机引脚赋值
tim = Timer(3,freq=100) #设置定时器3的的频率
ch = tim.channel(1,Timer.PWM,pin = p) #调用定时器channel函数定时器3 chann1
# ch.pulse_width_percent(50)
while True:
#从暗到亮
for i in range(100):
ch.pulse_width_percent(i) #设置占空比
time.sleep_ms(10)
#从亮到暗
for i in range(99,1,-1):
ch.pulse_width_percent(i)
time.sleep_ms(10)
https://steampp.net/
https://bemfa.com/