Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

Sense HAT(1)

alienzhangyw edited this page Apr 25, 2020 · 2 revisions

This page introduces some tutorials of BlockPi(v1.1.0+) controlling the Sense HAT expansion board.

If you don't have a physical Sense HAT, you can use the Sense HAT Emulator on your Raspbian to emulate it.

Crossing signal light

See the video bellow:

https://video.zhihu.com/video/1221104755663024128

First of all, initialize the Sense HAT, tick Emulator if you're using it. Low lightness mode is useful in dark environment.

To display the red light symbol:

To display the green light symbol:

To display the green reversed counter:

The whole program:

The save file is here(Right-click then save-as).

Compass 1

Displays direction letter like a compass, see the video bellow:

https://video.zhihu.com/video/1221105094928134144

0 degree(North) of the compass is the direction of the USB ports on the RPi board, so you have to turn the LED Matrix 90 degrees clockwise.

The save file is here.

Compass 2

A more premium compass, indicates North. Video bellow:

https://www.zhihu.com/video/1221105403939074048

First, display a circle on the LED Matrix. These are the indexes to the pixels you need:

Save the 20 pixels in a list in turn:

Be advised that the X-Y coordinate of the left-top of the Matrix is [0, 0], and pixel No.39 is [7, 4]. Use modulo and exact division to get the coordinates and light the pixels.

Get the index of North direction and turn the pixel red. You should reverse the compass data and divide it to 20 parts. When the red pixel moves, don't forget to turn the previous one blue.

The whole program:

The save file is here.