diff options
author | Damien George <damien.p.george@gmail.com> | 2016-08-29 17:33:02 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-08-29 17:33:02 +1000 |
commit | efc904c41d4acc631ec0781a7489c382d6d0b396 (patch) | |
tree | dbc92ce048bc3b24c124b938a287a4b1a78d795e /docs/pyboard/quickref.rst | |
parent | 5c3a2f162ec08aa2df900f25e87abb5d74e39c7c (diff) | |
download | micropython-efc904c41d4acc631ec0781a7489c382d6d0b396.tar.gz micropython-efc904c41d4acc631ec0781a7489c382d6d0b396.zip |
docs/pyboard/quickref: Add section on "delay and timing" for utime mod.
And remove reference to deprecated pyb.delay() and pyb.millis().
Diffstat (limited to 'docs/pyboard/quickref.rst')
-rw-r--r-- | docs/pyboard/quickref.rst | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/docs/pyboard/quickref.rst b/docs/pyboard/quickref.rst index 140452a9b0..3d08ae9109 100644 --- a/docs/pyboard/quickref.rst +++ b/docs/pyboard/quickref.rst @@ -20,14 +20,25 @@ See :mod:`pyb`. :: import pyb - pyb.delay(50) # wait 50 milliseconds - pyb.millis() # number of milliseconds since bootup pyb.repl_uart(pyb.UART(1, 9600)) # duplicate REPL on UART(1) pyb.wfi() # pause CPU, waiting for interrupt pyb.freq() # get CPU and bus frequencies pyb.freq(60000000) # set CPU freq to 60MHz pyb.stop() # stop CPU, waiting for external interrupt +Delay and timing +---------------- + +Use the :mod:`time <utime>` module:: + + import time + + time.sleep(1) # sleep for 1 second + time.sleep_ms(500) # sleep for 500 milliseconds + time.sleep_us(10) # sleep for 10 microseconds + start = time.ticks_ms() # get value of millisecond counter + delta = time.ticks_diff(start, time.ticks_ms()) # compute time difference + LEDs ---- |