Let's brighten up our text with colors!
We have understood how to write text on the screen, but it is white. Let's try to write it in blue for example! We'll help you a little bit: the instruction to change the color is as follows: display.setColor(color.RED)
It's up to you!
display.setColor(color.RED)
(and in all the instructions we will see later), case sensitivity (upper and lower case) is very important! If you write the same thing in lowercase, the program will no longer work.from gamebuino_meta import begin, waitForUpdate, display, buttons, color
while True:
waitForUpdate()
display.clear()
display.setColor(color.BLUE)
display.print("My name is Bob")
The instructions are read one after the other. So we told our program to select the blue color, and then write the text on the screen, with the color previously chosen.
Try to change the color, for example with YELLOW, PINK, BROWN... Try also to write several sentences in a row, in different colors. You shouldn't have too many problems!
If you block, look at the little program we made:
from gamebuino_meta import begin, waitForUpdate, display, buttons, color
while True:
waitForUpdate()
display.clear()
display.print("Hello!")
display.setColor(color.BLUE)
display.print("My name is Bob.")
display.setColor(color.RED)
display.print("\n")
display.print("What's your name?")
Nothing new in all this! We only added instructions, in the right order. You don't know display.print("\n")
: this instruction simply allows you to make a line break.