powered by TinkerSpace.in
Join free
TinkerPy Projects lessons
๐Ÿ’ก
Lesson 2 of 10 ยท Starter ยท 10 min

Blink an LED

Turn a light on and off with o1, pwm() and wait().

๐Ÿ”Œ Wiring

Connect an LED to output o1.

To switch o1 on, give it power with pwm(100) โ€” that means 100% power. To switch it off, set it to 0.

wait(500) makes the board wait for 500 milliseconds โ€” that is half a second.

TinkerPy
setup:

loop:
    o1 = pwm(100)
    wait(500)
    o1 = 0
    wait(500)
On for half a second, off for half a second, forever.
๐Ÿ’ก Tip

Press Run on the simulator first โ€” you will see the LED blink on screen before you even plug in the board.

๐Ÿš€ Your turn

Make it blink faster (try wait(100)) and then slower (try wait(2000)).