Download presentation
Presentation is loading. Please wait.
1
BBC Microbit
2
Objective of the lesson
Use Block Editor to make a Windmill All of you will: Make a rotating windmill animation Most of you will: Make button A stop the windmill animation Some of you will: Make button B start the windmill animation
3
Windmill We will create a windmill animation Add a ‘forever’ loop Add a series of LED images with short pauses between to show a rotating windmill
5
Now we will replace the forever with a ‘while True loop’
This lets the animation run as long as a condition is True
6
Create a new variable. Call it rotating. Set rotating to true
This means that this variable is ‘on’ Change the while ‘true’ to while ‘rotating’
7
Therefore whilst the variable ‘rotating’ is true (or on), then the program in the
while loop will run Now add a ‘on button A pressed loop Add in the rotating variable and set it to false Now the variable ‘rotating’ is true (or on) and the windmill animation in the while true loop runs When the button A is pressed, the variable ‘rotating’ is false (or off) and the windmill animation in the while true loop stops running
8
Challenge Change the program so that button A stops the animation Change the program so that button B starts the animation
9
Answers
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.