The_Official_Raspberry_Pi_-_Beginner’s_Book_Vol1,_2018 (1)

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

THE OFFICIAL RASPBERRY PI BEGINNER’S GUIDE


when clicked


set all pixels to white


Without looking directly at the Sense HAT’s LEDs, click the green flag: you’ll see all the LEDs
turn a bright white (Figure 7-11), which is why looking straight at them when you run your
program isn’t a good idea!


5 Figure 7-11: Don’t look directly at the LEDs when they’re all bright white


Try clicking the down arrow next to ‘white’ and picking a different colour, then running your
program again. When you’re finished, change the colour to ‘off’ and run your program one last
time to turn all the LEDs off.
If the preset colour selection isn’t to your liking, you can have more control by mixing
individual colour elements: red, green, and blue. Drag the set all pixels to off block off the
script area to delete it, then replace it with a set all pixels to R 255 G 255 B 255 block.


when clicked


set allpixels to R^255 G^255 B^255

Free download pdf