This project uses Micro:bit single board as a digital counter, uses built-in button A to increase counting, built-in button B to decrease counting, programmed by MakeCode blocks. This project requires no any extra hardware or wiring, the project contains several interesting further challenging tasks. Goals:
Variable basic understanding
Use integer type variable
Software: if-else logic condition, comparison judgement
START A BIT > Projects Library > This page
Here are 2 examples of the successful results done by our students.
Nothing to do, just need a Micro:bit single board
Initially, the LED matrix should show the counter result as 0
Every time pressing button A, the counter increases by 1, the LED matrix shows the new counting result
Every time pressing button B, the counter decreases by 1, the LED matrix shows the new counting result
When the counter hits minimum value as 0, it should not continue decreasing
When pressing A+B together, reset the counting, LED matrix shows 0
[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-20 minutes: Programming
3 minutes: Download and test, correct and retest
One should have prior knowledge
Micro:bit V2 board: Know what they are, better to have prior experience using
MakeCode by Microsoft, the programming tool, better to have prior experience using it with Micro:bit
1x Micro:bit V2 board , with USB cable
You need a variable to help remembering the counting, use "Variables -> Make a variable... ", give it a name, e.g. "counter", then you see below 3 blocks available to manipulate this new variable, to increase/decrease it, or use it.
To get the button input, use "Input -> on button... pressed"
To show the counter result on Micro:bit built-in LED matrix, use "Basic -> show number...". Drag your variable block into the white vacancy, it will display the value in LED matrix.
To link the logic, you need a if-else block and logic judgement block as well, use "Logic -> Conditionals -> if... then..." and "Logic -> Comparison -> ... = ..."
Of course, you need "on start" and "forever" blocks to set it run in a proper manner. Not both needed.
These are all the needed types of blocks, be aware that some blocks might be needed for multiple times, duplicate them if needed. Usually, by this tip so far and active exploration, you can get it done!
…Please try really hard, before getting super tips if you are stuck.
This optional part covers further competence development, in terms of testing, troubleshooting, analysis, documentation, flow chart diagrams practices, etc.
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
This project is a good example to practice flow chart drawing! Use your own way to visualize how the programming controlling logic is done, by a free style drawing, so that your friends can follow this flow-chart to reproduce the programming.
Here is a super tip with examples of how this could be done.
Show us which is the variable used in your program, explain how it is helping you there
These questions are out of scope for this project, but great to think about them, ask and discuss if you have enough effort
NA
If you get a quick done, do you dare to take further challenges? Those challenging points are independent, not related to one another
Make a beep sound reminder if the counting result becomes full 10, 100, 1000, note that the beep should happen just once when hitting the full counting, but not keep beeping all the time.
Energy saving mode: When there is not many visitors coming, the counter will be idle for some time, so there is a need to save energy, don't display the counter figure all the time, instead, display it when shaking the Micro:bit, after 3 seconds, turn off the display