The_Official_Raspberry_Pi_-_Beginner’s_Book_Vol1,_2018 (1)

(singke) #1
Chapter 7 Physical Computing with the Sense HAT 157

THE OFFICIAL RASPBERRY PI BEGINNER’S GUIDE


when clicked
scroll message Hello, World! atrotation^0 incolour white background off

There’s a lot to unpack in that single block, but for the moment just click the green flag on
the stage area and watch your Sense HAT or the Sense HAT emulator: the message will scroll
slowly across Sense HAT’s LED matrix, lighting up the LED pixels to form each letter in tur
(Figure 7-3). Congratulations: your program’s a success!


5 Figure 7-3: Your message scrolls across the LED matrix


Now you can scroll a simple message, it’s time to take a look at the other features of the
scroll message block. As well as being able to modify the message to be displayed, you
can alter the rotation – which way the message is displayed on the Sense HAT. Click on the
down arrow next to 0 and change it to 90, so the scroll message block says ‘Hello, World!
at rotation 90 in colour white background off’. Click the green flag and you’ll see the same
message as before, but rather than scrolling left-to-right it will scroll bottom-to-top (Figure 7-4,
overleaf) – you’ll need to turn your head, or the Sense HAT, to read it!

Free download pdf