5. case 02:Dice#

5.1. Our Goal#


  • Use watch kit to make a wearable dice.

5.2. Material Needed#


  • 1 x Watch kit

5.3. Hardware Connection#


Asmmble our watch kit directly just like the picture below.

../../_images/vOZpBF4.jpg

5.4. Software#


Microsoft Makecode

5.5. Programming#


Step 1#

  • Drag out an on shake block from input.

  • Create a variable num and assign value to this variable with a random number among 0 to 5.

  • Insert a if block. When the random number picked is 0, then display one point. If the random number is 2, then display two points. And so on.

../../_images/o0VecJj.png

Program#

5.6. Result#


  • Every time when we shake our micro:bit, a random number is created.

5.7. Think#


5.8. FAQ#


5.9. Relative Readings#