Download presentation
Presentation is loading. Please wait.
Published bySiebe van der Meer Modified over 5 years ago
1
micro:bit for primary schools – mb4ps.co.uk
Sessions 4 and 5 Animations and brightness Written by Neil Rickus. Licensed under CC BY-NC-SA 4.0
2
Objectives Alter the brightness of the LEDs
Use a variable to alter the brightness Trigger events with the buttons
3
Altering LED brightness
Last time we made an animation We’re now going to make a heart fade in What blocks do you think we could use?
4
Altering LED brightness
These instructions will make a heart flash
5
Challenges Make your heart fade in more gradually
Get the LEDs to dim, then go brighter
6
Using variables We can use a variable to store the brightness
Create a new variable called “myBrightness” We’ll then set this variable to zero
7
Using variables Through using the variables, we can reduce the number of instructions we need
8
Challenges Alter the speed of the fade by:
Changing the length of the pause Altering the brightness increase
9
Programming events We can make the heart only appear when you shake the device
10
Challenges Make the heart go brighter if you press button A – try this block Make the heart go darker if you press button B Make the heart vanish if you press A and B at the same time Make the heart go brighter if you tilt the micro:bit screen upwards Make the heart go darker if you tilt the micro:bit screen downwards
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.