summaryrefslogtreecommitdiff
path: root/tests/pybnative/while.py
diff options
context:
space:
mode:
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)