This project makes fun animation of the random rain drops using the LED matrix of TM005: Micro:bit V2 board, it can be used as starting experience of Micro:bit, inspiring fun ideas with the built-in sensors/actuators to create games. The program is made by MakeCode, the codes logic is simple, the implementation can be rather straightforward in a kids way, or can be guided to improve for very well structured logic using Variables/Functions/Loops. Goals:
Fun experience with Micro:bit's LED matrix, also as preparations for further creative projects
Experience with simple programming, inspire to start using Functions/Loops (Not a must, but motivate a feeling of the needs)
Enhance starting experience of making-flow with Micro:bit (programming, download, test, etc.)
START A BIT > Projects Library > This page
Here is an example of the result done by our student.
Just a single Micro:bit board, a USB cable
There could be many creative ideas to make the result more fun than what we write here, still, it's good to think about a very basic starting requirement for now:
As shown in the demo, animate the rain dropping down
Just one rain drop moving each time, i.e. no parallel lines of rain dropping
It should be random vertical line to animate rain dropping each time
No specific requirement of speed
[x] Simple: 30-60 minutes
[ ] Moderate: 1-2 hours
[ ] Challenging: more than 2 hours
The estimation bases on average situation without unexpected troubleshooting, assuming that the student meets prerequisites. It only indicates rough time needed to complete this project, but not about technical difficulty, not covering discussion and sharing time. Here is a possible breakdown:
5 minutes: Understand requirement and solution, collect materials
15-30 minutes: Explore free style programming to make the result
15-30 minutes: Optional, optimization efforts to make the program efficient and neat in logic, using Functions, Looping, Variables
One should have prior knowledge
Micro:bit V2 board: Know what they are, better to have prior experience with it
MakeCode by Microsoft, the programming tool, better to have prior experience using it with Micro:bit
Better to have done PJ000: 1st Experience with Micro:bit and MakeCode
Function knowledge is not a must, but good to have prior ideas of what it is
1x Micro:bit V2 board , with USB cable
Micro:bit LED screen has 25 LED arranged in a 5x5 grid.
Use (x,y) coordinates to specify a particular LED, x is the horizontal position (0,1,2,3,4) y is the vertical position (0, 1, 2, 3, 4).
Use plot and unplot to turn a LED on or off
More info here from MakeCode document (link)
Not all blocks are used, pick that you want
plot to draw a point
unplot to erase a point
toggle is to flip over the state of the point
Led ->
Led ->
Led ->
This block is useful to get a random value
Math->
Most possibly you need to use variables to help remembering something, try to use it
Variables ->
Not a must, but it's highly recommened to consider using Functions! You can do so as an optimization after creating a working prototype.
Advanced -> Functions
Not all of those are needed, it's highly recommended to consider looping blocks available there, try to use them when you need to do some work repeatedly
Loops ->
Loops ->
Loops ->
This is a very straightforward way to draw/erase the points in a sequence so to make the animation of a rain dropping line.
NOTE:
It's not efficient way, but just as a tips for your starting. When coming to several rain dropping lines, the program could contain big amount of duplications, which is tiring and ugly!
Anyhow, this project doesn't strictly require the program to be professional and efficient, please feel free to make your own working result :-)
Stand in front of the class, share with your group what you have made, please cover important points
Tell what it is your product
Demonstrate how it works
Explain how it works
Share with your group about
What troubles you met
How you analyze
How you get help
How you solve it
What you have learnt
When you have got a working version, please consider
Are you happy with the codes (readability, maintainability, etc.)
What can we do to simplify/optimize it as a pro?
If you get a quick done, do you dare to take further challenges? Those challenging points are independent, not related to one another
Please consider optimize your program using Variables/Functions/Loops, you will be like a PRO with those!
How about parallel rain dropping lines?
How about creating a gaming rule basing on this animation? Like Whac-A-Mole (link of wikipedia)
Find out working copies as a MakeCode shared projects, these 2 examples shows the difference before and after optimization using Functions.
Used as homework in LP2415: 4 Weeks Refreshing Package, 24w15