This project uses a single Micro:bit to implement 3 versions of Digital Dice, this is part of the starting experience of Micro:bit and basic programming logic of if-else and usage of Variable . Junior learners should take Task 1-2, challenge takers should try Task 3-4 further. Goals:
Fun playing with Micro:bit with gesture sensor to catch shaking events
Practice of basic if-else logic, and nested if-else up to 2 levels
Basic usage of Variable (numeric integer type), up to 2 variables in use
A basic experience using simulator and debugging mode
START A BIT > Projects Library > This page
This is a demo for Task 2
[ ] Simple: 30-60 minutes
[x] 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. Possible breakdown:
Task 1: 10 minutes
Task 2: 15-30 minutes
Task 3: 30-45 minutes
One should have prior knowledge
Purpose: Simplest version with basic feature as a starting
On shaking, display random number 1-6 on the LED screen
Test Case 1:
Shake the board, the LED screen should show a number ranged 1-6
Test Case 2:
Repeat test case 1, until you can ensure all 6 numbers can be covered
Test Case 1:
Shake the board, the LED screen should show a number ranged 1-6
Please submit your work to Google Classroom (here is a guide)
You can check this "Dice" project from microbit.org as an example
How to get catch gesture shaking event
How to get random number
Purpose: Typical use case for Variable and if-else
On shaking, display random one of below 6 simulated icons on the LED screen
When drawing a "lucky 6", play a celebration sound
Test Case 1:
Shake the board, the LED screen should show a random icon
Test Case 2:
Repeat test case 1, until you can ensure all 6 icons can be covered
Test Case 3:
When drawing a "lucky 6", a celebration sound is heard
Test Case 1:
Shake the board, the LED screen should show a random icon
Test Case 2:
When drawing a "lucky 6", a celebration sound is heard
Please submit your work to Google Classroom (here is a guide)
You can check this "Graphical dice" from microbit.org as an example
Same as Task 1
Use a variable to remember the number
if-else logic
Play a sound
The tutor shows you how to use debugger, with
Slow-motion
Breakpoint setting
Stepping
Variable values inspection
If-else branching decision and actual steps execution
Purpose: A small challenge, typical use case in need of nested if-else, and 2 Variables
On shaking, display random one of below 6 simulated icons on the LED screen
Only when drawing "Double-6" (twice of "lucky 6" continuously), play a celebration sound
Test Case 1:
Shake the board, the LED screen should show a random icon
Test Case 2:
Repeat test case 1, until you can ensure all 6 icons can be covered
Test Case 3:
Only when drawing "Double-6", a celebration sound is heard
Test Case 1:
Shake the board, the LED screen should show a random icon
Test Case 3:
Only when drawing "Double-6", a celebration sound is heard
Use Task 2 as a base, no working copy as example here, please explore and try out your ideas!
Same as Task 2
New need of extra variable to remember the previous result
Please submit your work to Google Classroom (here is a guide)
This task contains 2 levels of if-else logic, and 2 variables, it's very interesting to inspect them using debugger, with
How the 2 Variable values are changed
If-else branching decision and actual steps execution, especially the nested if-else
Purpose: Creative task for your ideas, as an optional challenge task
Based on Task 2, but count how many times drawing has happened before the user gets "A Lucky 6".
Hint: An Extra variable is needed to count the times of drawing, need to have a way to show the counting result, either show on LED screen, or print to serial monitor (if you know what/how)
Based on Task 3, keep original feature of Task 3, and add extra feature to also celebrate "Sum-10", which means 2 continuous draws results summing up as 10.
Purpose: Enhance basic knowledge understanding, reflect and summarize what we have learnt
What is variable, what is the main purpose of using it in this project?
How do we get shaking input? What will it happen?
Tips: Review knowledge from here if needed
Follow the tutor to take 5-10 minutes to review the questions and answers, correct some possible misunderstood issues or faults
Take 1-2 minutes to explore anything on the tools and the making flow, with curiosity, no matter how much prior knowledge you have, you should make
At least 1 interesting finding
At least 1 curious question