Damien George
11 years ago
6 changed files with 57 additions and 19 deletions
@ -0,0 +1,15 @@ |
|||
import pyb |
|||
|
|||
@micropython.native |
|||
def f1(n): |
|||
for i in range(n): |
|||
print(i) |
|||
|
|||
f1(4) |
|||
|
|||
@micropython.native |
|||
def f2(r): |
|||
for i in r: |
|||
print(i) |
|||
|
|||
f2(range(4)) |
@ -0,0 +1,8 @@ |
|||
0 |
|||
1 |
|||
2 |
|||
3 |
|||
0 |
|||
1 |
|||
2 |
|||
3 |
@ -1,14 +1,15 @@ |
|||
import pyb |
|||
|
|||
@micropython.native |
|||
def f(led, n): |
|||
def f(led, n, d): |
|||
led.off() |
|||
i = 0 |
|||
while i < n: |
|||
print(i) |
|||
led.toggle() |
|||
d = pyb.delay |
|||
d(50) # pyb.delay(50) doesn't work! |
|||
pyb.delay(d) |
|||
i += 1 |
|||
print(i) |
|||
led.off() |
|||
|
|||
f(pyb.LED(1), 2) |
|||
f(pyb.LED(2), 4) |
|||
f(pyb.LED(1), 2, 150) |
|||
f(pyb.LED(2), 4, 50) |
|||
|
Loading…
Reference in new issue