Login

Please fill in your details to login.





micro:bit - magic 8 ball with micropython

This page is mainly about micro:bit - magic 8 ball with micropython
# Magic 8 ball by Nicholas Tollervey. February 2016.
#
# Ask a question then shake.
#
# This program has been placed into the public domain.
from microbit import *
import random

answers = [
    "It is certain",
    "It is decidedly so",
    "Without a doubt",
    "Yes, definitely",
    "You may rely on it",
    "As I see it, yes",
    "Most likely",
    "Outlook good",
    "Yes",
    "Signs point to yes",
    "Reply hazy try again",
    "Ask again later",
    "Better not tell you now",
    "Cannot predict now",
    "Concentrate and ask again",
    "Don't count on it",
    "My reply is no",
    "My sources say no",
    "Outlook not so good",
    "Very doubtful",
]

while True:
    display.show('8')
    if accelerometer.was_gesture('shake'):
        display.clear()
        sleep(1000)
        display.scroll(random.choice(answers))
    sleep(10)



Catalogue

All third party documentation is provided purely for educational purposes and must not be distributed. If you are the copyright owner of these documents and you do not with me to make them available here, please get in touch.
Last modified: August 3rd, 2022
The Computing Café works best in landscape mode.
Rotate your device.
Dismiss Warning