summaryrefslogtreecommitdiff
path: root/tests/pybnative/while.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-05-07 18:55:31 +0100
committerDamien George <damien.p.george@gmail.com>2014-05-07 18:55:31 +0100
commit9102af6afbc65bb7c4597e3f8371f6e72a6aebd9 (patch)
treed056d9064584524f28bd66f33d2c6ae89003b358 /tests/pybnative/while.py
parentc4ccb078a52276fc95e407602676f14d34a3f3c1 (diff)
tests: Add a test for native code on pyboard.
Diffstat (limited to 'tests/pybnative/while.py')
-rw-r--r--tests/pybnative/while.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/pybnative/while.py b/tests/pybnative/while.py
new file mode 100644
index 000000000..a3f64a800
--- /dev/null
+++ b/tests/pybnative/while.py
@@ -0,0 +1,14 @@
+@micropython.native
+def f(led, n):
+ led.off()
+ i = 0
+ while i < n:
+ led.toggle()
+ d = pyb.delay
+ d(50) # pyb.delay(50) doesn't work!
+ i += 1
+ print(i)
+ led.off()
+
+f(pyb.LED(1), 2)
+f(pyb.LED(2), 4)