MoonCampaign by Yashas (9 years)
Random Number
Yashas
Show and Tell
Show n Tell
Coming Soon
Hello! My name is Yashas. I’m 9 years old, and I enjoy swimming and playing outside. For my show-and-tell project, I made a Random Number Generator using the micro:bit. When you shake the micro:bit, it uses a random command to choose a number between 1 and 6. I used the random.randint block to do this. The number shows up on the screen after a 1-second pause, which I added using the sleep(1000) command. You can also change the number range—like from 1 to 8—to get different results. It’s a fun way to practice coding and randomness!
Hi everyone! My name is Yashas. I am 9 years old and in school, I enjoy learning new things—especially when it comes to coding. In my free time, I like swimming and playing outside. For my show-and-tell project, I created something simple but fun: a Random Number Generator using the micro:bit.
My project works like a digital dice! When you shake the micro:bit, it randomly picks a number. I used the random.randint block in the code to choose a number between 1 and 6. Once the number is chosen, it appears on the micro:bit screen.
To make the program smoother, I also added a pause using the sleep(1000) command, which makes the micro:bit wait 1 second before showing the result. If I change the number range in the code—for example, from 1 to 8—the micro:bit will pick from that new range too. I tested it and it worked perfectly!
This project helped me understand how randomness, inputs, and timing work in code. It was really cool to see how shaking a small device could create a new number each time. I had fun making this and I hope you enjoyed learning about it!
©️ Copyright, Moonpreneur Inc.
3031 Tisch Way, 110 Plaza West PMB # 138, San Jose, CA 95128, USA
Likes
Rating
50 days left
Random Number