Moonpreneur Icon

How to make dice on micro:bit

MoonCampaign by Zuhny (10 years)

Likes

Rating

46 days left

Your support will go a long way in encouraging Zuhny and taking their innovation How to make dice on micro:bit to new heights.
How to make dice on micro:bit
terms and conditions
:

How to make dice on micro:bit

:

Zuhny

:

Show and Tell

:

Show n Tell

:

Coming Soon

About the Innovator

I am presenting my project on how to make a digital dice using a Micro:bit. This project uses the Micro:bit’s shake gesture and random number generation to display numbers just like a real dice. When the Micro:bit is shaken, the code generates a random number from 1 to 6 and scrolls it on the screen. I also learned how to add text and images for different numbers using display functions. This project helped me understand how random numbers, gestures, and display commands work together in Micro:bit coding.

Want your child to be part of an innovative and creative competition?

STORY

Total Views:

I am excited to present my project on how to make a digital dice using a Micro:bit. This project demonstrates how coding and sensors can be used to recreate a real-life object digitally.

The main idea of this project is to use the shake gesture of the Micro:bit to generate a random number, just like rolling a physical dice. To do this, I first imported the random library, which is essential for generating random numbers. Without importing this library, the dice would not work correctly. When the Micro:bit is shaken, the program generates a random number between 1 and 6, and the number is displayed on the LED screen.

I also learned how to control what appears on the Micro:bit display. Using commands like display.scroll() and display.show(), I can show numbers, text, or even images. For example, if the generated number equals one, the Micro:bit can display a heart image or scroll a message. This allows the dice to be customized in many creative ways. Although the Micro:bit screen can only display two digits clearly at a time, the code itself can handle many numbers.

The project also helped me understand how if conditions work. These conditions tell the Micro:bit what to do when a specific number is generated. Display functions are very important because without them, nothing would appear on the screen.

Overall, this project helped me learn about random number generation, gestures, conditions, and displaying text and images. It was a fun and interactive way to understand how coding can turn simple ideas into working digital projects.

Every child is gifted. Discover how yours can innovate and lead

Comments

You Might Also Like

Every child is gifted. Discover how yours can innovate and lead