m5stack / M5Cloud

Micropython Web IDE beta version
http://io.m5stack.com/
145 stars 34 forks source link

PWM sample code in README.md is wrong (duty range is not 0-1024) #23

Closed stnk20 closed 6 years ago

stnk20 commented 6 years ago

Sample code in README.md contains wrong information. pwm.duty(666) is out of range. pwm.duty is in range 0-100, not 0-1024

import machine
pwm = machine.PWM(26)
pwm.freq(5000)
pwm.duty(666)

And servo.py has same issue: https://github.com/m5stack/M5Cloud/blob/2da5a04668a754847128376d1422de1ef89f5764/lib/servo.py#L31

0x1abin commented 6 years ago

Thanks for your feedback, I fixed it.