summaryrefslogtreecommitdiff
path: root/examples/SDdatalogger/boot.py
diff options
context:
space:
mode:
authorSebastian Plamauer <oepse@gmail.com>2014-05-04 19:07:17 +0200
committerSebastian Plamauer <oepse@gmail.com>2014-05-04 19:07:17 +0200
commit96e97ed2ceeda9de9ed0dab69a7ee4f701a42a40 (patch)
tree723354723af7bb9bdb5bbab59fc7da2371f1a809 /examples/SDdatalogger/boot.py
parent5fc400ccdb17a7208fbf2d3ea93985d922b1a35d (diff)
created SDdatalogger example
Diffstat (limited to 'examples/SDdatalogger/boot.py')
-rw-r--r--examples/SDdatalogger/boot.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/SDdatalogger/boot.py b/examples/SDdatalogger/boot.py
new file mode 100644
index 000000000..f5006df93
--- /dev/null
+++ b/examples/SDdatalogger/boot.py
@@ -0,0 +1,24 @@
+# boot.py -- runs on boot-up
+# Let's you choose which script to run.
+# > To run 'datalogger.py':
+# * press reset and do nothing else
+# > To run 'cardreader.py':
+# * press reset
+# * press user switch and hold until orange LED goes out
+
+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
+
+if switch():
+ 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()