Next we'll program the Pi in Scratch to blink the LED.
- Click the yellow "events" block group, then drag and drop the "when (flag) clicked" block over to the "script area" on the right side of the program's interface.
- Next click the orange "control" block group section and drag in a "forever" loop.
- Also from the "control" section, drag in two
wait 1 seconds
blocks. - Then click on the "Raspberry Pi GPIO" block section and drag in two
set gpio to output
blocks. Set one block toset gpio 2 to output high
. Set the other toset gpio 2 to output low
. - Lastly rearrange the blocks in the order as shown.
Now click the green flag and see what happens!
Page last edited March 08, 2024
Text editor powered by tinymce.