You can turn each pixel on the micro:bit's display on to varying brightnesses, using the syntax shown below.
Download our design worksheet for more help!
myImage = '00000:24642:57975:24642:00000' display.show(Image(myImage))
Create as many images as you need for your dice, giving each one a different name.
Once you have finished designing your images, put them in a list!
If I had three images, called imageOne , imageTwo , imageThree - my list would look like this:
myImages = [imageOne, imageTwo, imageThree]
Define your list after you have defined the images, but before you try to display them.
Now you have a list with all of your images in, you can tell the micro:bit to display a random image, instead of a random integer.
Change:
roll = randint(1, 6) display.show(roll)
to
roll = choice(myImages) display.show(Image(roll))
Test this out - does your micro:bit show a random image when you roll it?
What happens to your second micro:bit, which is receiving messages over the radio?
To find out more about the code on the second micro:bit click here.
Unplug your original micro:bit and plug in the new one.
Open a new file in Mu, then copy-and-paste the second micro:bit code (if you have already been working on the second micro:bit's code, then carry on using your version).
Edit radio.config(channel=7) to be your channel number.
Edit display.show(message) to this new code:
display.show(Image(message))
Test your code - roll your original die (make sure it has power!) and check that both micro:bits show your images.