Download presentation
Presentation is loading. Please wait.
2
Objective of the lesson
Use Blockly to create blinking lights All of you will: Control individual LEDs on the Codebug Most of you will: Animate individual LEDs on the Codebug Some of you will: Use buttons to control the LEDs on the Codebug
3
Go to Click on CREATE and then on the Blockly Tab You will see a simulation of the Codebug. The Triangular Play button can be used to run your program and view what will happen once you download to your Codebug
4
We can turn on individual LEDs
The LEDs are called pixels We can turn on individual pixels or LEDs at coordinates x and y To turn ON an LED we set it to 1
5
The problem is that all of the lights come on at once
We need to add pauses inbetween lights coming on Pauses are in milliseconds (ms). 1000ms = 1 second
6
Add a forever loop so that the lights Make it so that the same message plays if the B button is pressed Make it so that a different message plays when the B button is pressed
7
Challenge Loop the program so that the animation continues forever (using a while True loop) Add an ‘if do on button A pressed’ loop so that the animation only shows when the button is pressed Change the x, y coordinates to change the direction or pattern of the animation Turn pixels ON and OFF one at a time by setting the pixel to 0
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.