MoonCampaign by Zuhny (10 years)
Our Social Impact - We're transforming education globally with free robotics and math workshops in the US, UK,
Canada, and Australia.
Our workshops have helped 66,000 students alone in the US plus 14,000 students benefit from our four-week sessions.
How to make dice on micro:bit
Zuhny
Show and Tell
Show n Tell
Coming Soon
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.
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.
©️ Copyright, Moonpreneur Inc.
691 S Milpitas Blvd, STE 217 Milpitas CA 95035, USA
Likes
Rating
46 days left
How to make dice on micro:bit