diff options
author | Damien George <damien.p.george@gmail.com> | 2014-05-05 14:09:23 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-05-05 14:09:23 +0100 |
commit | fa2e701e23104e7b970294d44b4015a7e5928ffd (patch) | |
tree | b9ec400978ef6990b8dc092fbe0f05f3f65c513d /examples/SDdatalogger/boot.py | |
parent | 2a5b3cdf82e9798725e43dd6840da043f3b5e209 (diff) |
examples, SDdatalogger: Add more comments; reduce power consumption.
Diffstat (limited to 'examples/SDdatalogger/boot.py')
-rw-r--r-- | examples/SDdatalogger/boot.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/examples/SDdatalogger/boot.py b/examples/SDdatalogger/boot.py index f5006df93..aa943fde9 100644 --- a/examples/SDdatalogger/boot.py +++ b/examples/SDdatalogger/boot.py @@ -8,17 +8,18 @@ import pyb -pyb.LED(3).on() -pyb.delay(2000) -pyb.LED(4).on() -pyb.LED(3).off() -switch = pyb.Switch() # check if switch was pressed decision phase +pyb.LED(3).on() # indicate we are waiting for switch press +pyb.delay(2000) # wait for user to maybe press the switch +switch_value = pyb.Switch()() # sample the switch at end of delay +pyb.LED(3).off() # indicate that we finished waiting for the switch -if switch(): +pyb.LED(4).on() # indicate that we are selecting the mode + +if switch_value: pyb.usb_mode('CDC+MSC') pyb.main('cardreader.py') # if switch was pressed, run this else: pyb.usb_mode('CDC+HID') pyb.main('datalogger.py') # if switch wasn't pressed, run this -pyb.LED(4).off() +pyb.LED(4).off() # indicate that we finished selecting the mode |