Once you’ve mastered the basics of text you should have a a look at the documentation page to see what else is possible to display graphics and text to the micro:bit screen.
The display.scroll function has some optional parameters as well as the text that you want to display:
microbit.display.scroll(string, delay=150, *, wait=True, loop=False, monospace=False)
This means that if you want the message to keep looping around the screen you can try:
display.scroll(“Hello”, loop=True)
The code below creates a list of two strings (a string is some text), then randomly chooses one to display on the micro:bit screen:
Can you adapt the code to:
- Show (rather than scroll) a H or a T for heads or tails?
- Work as the sorting hat from Harry Potter (choose a random house from Ravenclaw, Gryffindor, Slytherin or Hufflepuff)?
- Say “Hello” in a random language?
- Tell one of three random jokes?