Warm-up Activity 5: Roll the Dice (Variables, Random Numbers, Conditionals)
File Name: ClassClassNoA5
Warm-up Activity 5: Roll the Dice (Variables, Random Numbers, Conditionals)
File Name: ClassClassNoA5
Objectives:
When you shake the micro:bit, 1 to 6 dots will randomly appear on the LED matrix.
Use the micro:bit dice to play with a classmate and see who rolls the higher number.
1. On shake
2. show leds
3. Conditional statement: if... then
4. Create a variable named "dice"
5. The default value of the variable is "0"
6. Set the start and end values for the random number
7. 將隨機數賦予變數"dice"
8. Sample code
9. Result