summaryrefslogtreecommitdiffstatshomepage
path: root/docs/wipy
diff options
context:
space:
mode:
authordanicampora <daniel@wipy.io>2016-02-23 20:18:45 +0100
committerdanicampora <daniel@wipy.io>2016-02-23 20:22:26 +0100
commit57b96a7be214c8f2493db7d430348f5efcc8ad34 (patch)
tree7cb85812ec5b4b1c7ce52755735c902459e90fda /docs/wipy
parent8e1fdf2eb3444740d1631878c270cf0003b5d404 (diff)
downloadmicropython-57b96a7be214c8f2493db7d430348f5efcc8ad34.tar.gz
micropython-57b96a7be214c8f2493db7d430348f5efcc8ad34.zip
docs: Correct machine.Timer code examples related to duty cycle.
Diffstat (limited to 'docs/wipy')
-rw-r--r--docs/wipy/quickref.rst12
1 files changed, 4 insertions, 8 deletions
diff --git a/docs/wipy/quickref.rst b/docs/wipy/quickref.rst
index a2886e78c6..6fd77a81bd 100644
--- a/docs/wipy/quickref.rst
+++ b/docs/wipy/quickref.rst
@@ -63,16 +63,12 @@ PWM (pulse width modulation)
See :ref:`machine.Pin <machine.Pin>` and :ref:`machine.Timer <machine.Timer>`. ::
from machine import Timer
- from machine import Pin
-
- # assign GP25 to alternate function 9 (PWM)
- p_out = Pin('GP25', mode=Pin.AF, alt=9)
- # timer 2 in PWM mode and width must be 16 buts
- tim = Timer(2, mode=Timer.PWM, width=16)
+ # timer 1 in PWM mode and width must be 16 buts
+ tim = Timer(1, mode=Timer.PWM, width=16)
- # enable channel A @1KHz with a 50% duty cycle
- tim_a = tim.channel(Timer.A, freq=1000, duty_cycle=50)
+ # enable channel A @1KHz with a 50.55% duty cycle
+ tim_a = tim.channel(Timer.A, freq=1000, duty_cycle=5055)
ADC (analog to digital conversion)
----------------------------------