“Hi, my name is Arturo, and I picked the Magic 8-Ball project for this Show and Tell,” he began, standing confidently.
He held up his micro:bit. “This project works by using random code to pick a random answer — just like the classic Magic 8-Ball toy.”
With a nod from the teacher, Arturo explained the core features. “The code uses if accelerometer.was_gesture("shake"), so if I shake the micro:bit, it will run the next part — random.randint(1, 18). This picks a random number between 1 and 18, and each number corresponds to a unique answer.”
He grinned. “I have a lot of replies stored. Some examples are ‘It is certain,’ ‘It is decidedly so,’ ‘My reply is no,’ and ‘My sources say no.’”
Sharing his screen, Arturo revealed how each random number matched to an answer via conditional statements. After the program picks an answer, the text scrolls across the LED display for the user to read.
“This way,” he continued, “every time you shake it, you get a new, fun, and unpredictable message. Just like asking the real Magic 8-Ball, you never know if you’ll get a yes, no, or something mysterious like ‘Ask again later.’”
Though it was a short presentation, Arturo’s explanation made the process easy to follow — from detecting the shake with the accelerometer, to generating a number, to mapping that number to a stored string, and finally displaying it.
The teacher smiled. “Great job, Arturo — simple, fun, and well explained!”
For Arturo, it wasn’t just about recreating a toy — it was about showing how sensors, randomness, and code can come together to make something interactive and entertaining. And each shake brought an answer… along with a smile.