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.
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!
display.print("xxx")
instruction is used to display text on the screenNote: 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!
from gamebuino_meta import begin, waitForUpdate, display, buttons, color
while True:
waitForUpdate()
display.clear()
display.print("My name is Bob")
It wasn't very difficult, was it? All you had to do was replace "Hello world" with "My name is Bob".
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)!