The_Official_Raspberry_Pi_-_Beginner’s_Book_Vol1,_2018 (1)

(singke) #1

156 THE OFFICIAL RASPBERRY PI BEGINNER'S GUIDE


Hello, Sense HAT!
As with all programming projects, there’s an obvious place to start with the Sense HAT:
scrolling a welcome message across its LED display. If you’re using the Sense HAT emulator,
load it now by clicking on the Raspbian menu icon, choosing the Programming category, and
clicking on Sense HAT Emulator.

Greetings from Scratch
Load Scratch 2 from the Raspbian menu, click on More Blocks in the blocks palette, then
the ‘Add an Extension’ button. Click on the ‘Pi SenseHAT’ extension (Figure 7-2), then the
OK button. This loads the blocks you need to control the various features of the Sense HAT,
including its LED display. When you need them, you’ll find them in the More Blocks category.

5 Figure 7-2: Adding the ‘Pi SenseHAT’ extension to Scratch 2

Start by dragging a when clicked Events block onto the script area, then drag a
scroll message block directly underneath it. Edit the text so the block reads ‘scroll message
Hello, World! at rotation 0 in colour white background off’.

PROGRAMMING EXPERIENCE
This chapter assumes experience with Scratch 2 or Python and
the Thonny integrated development environment (IDE), depending
on if you’re working through the Scratch or Python code examples


  • or both! If you haven’t done so already, please turn to Chapter 4,
    Programming with Scratch, or Chapter 5, Programming with
    Python, and work through the projects in that chapter first.

Free download pdf