diff options
| author | Damien George | 2019-12-04 15:02:54 +1100 |
|---|---|---|
| committer | Damien George | 2019-12-04 15:02:54 +1100 |
| commit | 90c524c1141ed9ad8fa882dba6f36199a7768e32 (patch) | |
| tree | 0ee0799df23cb231c47de6f0b885d6f124e448c6 /docs/pyboard/tutorial/fading_led.rst | |
| parent | 40cc7ec677e962c47db567479e42c27ed8911ff6 (diff) | |
docs: Remove spaces on lines that are empty.
Diffstat (limited to 'docs/pyboard/tutorial/fading_led.rst')
| -rw-r--r-- | docs/pyboard/tutorial/fading_led.rst | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/docs/pyboard/tutorial/fading_led.rst b/docs/pyboard/tutorial/fading_led.rst index 8303c9603..79648bee1 100644 --- a/docs/pyboard/tutorial/fading_led.rst +++ b/docs/pyboard/tutorial/fading_led.rst @@ -27,10 +27,10 @@ For this tutorial, we will use the ``X1`` pin. Connect one end of the resistor t Code ---- By examining the :ref:`pyboard_quickref`, we see that ``X1`` is connected to channel 1 of timer 5 (``TIM5 CH1``). Therefore we will first create a ``Timer`` object for timer 5, then create a ``TimerChannel`` object for channel 1:: - + from pyb import Timer from time import sleep - + # timer 5 will be created with a frequency of 100 Hz tim = pyb.Timer(5, freq=100) tchannel = tim.channel(1, Timer.PWM, pin=pyb.Pin.board.X1, pulse_width=0) @@ -47,16 +47,16 @@ To achieve the fading effect shown at the beginning of this tutorial, we want to # how much to change the pulse-width by each step wstep = 1500 cur_width = min_width - + while True: tchannel.pulse_width(cur_width) - + # this determines how often we change the pulse-width. It is # analogous to frames-per-second sleep(0.01) - + cur_width += wstep - + if cur_width > max_width: cur_width = min_width @@ -67,11 +67,11 @@ If we want to have a breathing effect, where the LED fades from dim to bright th while True: tchannel.pulse_width(cur_width) - + sleep(0.01) - + cur_width += wstep - + if cur_width > max_width: cur_width = max_width wstep *= -1 |
