Tutorials & Doc
Get started (Python)
Display text on the screen

Display text on the screen

Step 3
Step completed?

Now that you've launched your first program, it's time to get your hands dirty!

Let's go back to the code we executed in the previous step.

from gamebuino_meta import begin, waitForUpdate, display, buttons, color

begin()

while True:
    waitForUpdate()
    display.clear()

    display.print("Hello world")

The main notion to know is that a Python program is composed of instructions. Each instruction is equivalent to a line of code, and the instructions are executed one after the other. display.print("Hello world") is therefore an instruction to write Hello world on the screen! Don't worry about the other instructions at this time.

Challenge #1

Try changing the code to write the sentence "My name is Bob" on the screen. If you observe the code correctly, it shouldn't be too complicated!

Need help?

  • The display.print("xxx") instruction is used to display text on the screen
  • The quotation marks around your text are very important, don't forget them!
  • Don't forget to save your code in order to run it on your Gamebuino every time you make changes.

Note: if after saving your code nothing happens on the screen of your Gamebuino, which remains frozen, it is probably because there is an error! In this case, click on the "Serial" button (the one with the two arrows) in the Mu menu. This will open a small window at the bottom, in which you will have some information in case of error, and especially the line concerned! Feel free to keep this window open throughout this workshop, it will probably help you more than once!

Expected result

Solution

See
from gamebuino_meta import begin, waitForUpdate, display, buttons, color

while True:
    waitForUpdate()
    display.clear()

    display.print("My name is Bob")

Explanations

It wasn't very difficult, was it? All you had to do was replace "Hello world" with "My name is Bob".

Go further

Before you go any further, don't hesitate to have fun writing other things on the screen (your name may not be Bob, after all)!

Steps