View
216
Download
3
Category
Preview:
Citation preview
Electronic Dice 2
You will program the microbit so that when it is shaken a dice image comes up randomly
Add an ‘on shake’ loop
Add a variable called item
Change the name of the variable to be RandomNumber
Set the RandomNumber variable to be either 0,1,2,3,4,5
An If do, else condition
Add if RandomNumber = 0
This will show the dice image of the number six (because we do not have a random number 6)
Click on the cog and add in an ‘else if’. If the RandomNumber = 1 it should display the dice image of a 1
Challenge
1. Continue to add else if statements in for the remaining numbers2. Modify the code so that the dice only shows numbers 1,2 or 33. Modify the code so that the dice only shows numbers 1,2,3,4,5,6,7 or 8
Recommended