Chapter 7 Physical Computing with the Sense HAT 163
THE OFFICIAL RASPBERRY PI BEGINNER’S GUIDE
Click Run, and you’ll see the letter ‘Z‘ appear on the Sense HAT’s display. This time, it’ll
stay there: individual letters, unlike messages, don’t automatically scroll. You can control
sense.show_letter() with the same colour parameters as sense.show_message(),
too: try changing the colour of the letter to red (Figure 7-9).
5 Figure 7-9: Displaying a single letter
Next steps: Drawing with light
The Sense HAT’s LED display isn’t just for messages: you can display pictures, too. Each LED
can be treated as a single pixel – short for picture element – in an image of your choosing,
allowing you to jazz up your programs with pictures and even animation.
To create drawings, though, you need to be able to change individual LEDs. To do that, you’ll
need to understand how the Sense HAT’s LED matrix is laid out in order to write a program that
turns the correct LEDs on or off.
CHALLENGE: REPEAT THE MESSAGE
Can you use your knowledge of loops have a scrolling
message repeat itself? Can you make a program that spells
out a word letter-by-letter using different colours? How fast
can you make a message scroll?