How to Show a Message on a SenseHat

Hello, today I will be showing you how to display a message on a Raspberry Pi SenseHat.

Step 1: Hook Up the Raspberry Pi

Before we do any coding on the Raspberry Pi, we need to connect the right wires to it. Plug an HDMI cable into the HDMI port, plug in the power, and connect a keyboard and a mouse to it. If you want, you can connect an ethernet cable to it if you want to connect to the Internet. Connect it to a monitor, and voila! You can access the Raspberry Pi.

Step 2: Open Up Python 3 (IDLE)

In the top left corner of your screen, you should see a geometric raspberry icon. Click on that, and some options will come up. You should see "Programming". Click on that, and then click on "Python 3 (IDLE). A window should pop up called "Python 3.5.3 Shell

Step 3: Import SenseHat to Python

At the top left of the window, type (exactly as read):

from sense_hat import SenseHat

If you did it right, the"from" and "import" should be orange. Press enter, and type:

sense = SenseHat()

Make sure you use the parentheses. They signify a command.

Step 4: Display the Message

Press enter twice, then type:

sense.show_message("Your message here")

That should be it! Your message should be showing on the display!

Step 5: Optional Effects

If you want to get extra fancy, you can change the speed, text color, and background color of the message.

To change the text speed, enter the command like this:

sense.show_message("your message here", text_speed=random#)

1 is the default speed.

To change the color of your text or background, you need to set RGB variables first. RGB variables are colors, and you set them like this:

r = (255, 0, 0)

The first number is red value, the second green, and the third blue. After setting variables, enter the command like this:

sense.show_message("your message here", text_colour=variable, back_colour=variable)

You can combine any of these commands to change up your message.



    • Comfort Food Challenge

      Comfort Food Challenge
    • PCB Contest

      PCB Contest
    • Warm and Fuzzy Contest

      Warm and Fuzzy Contest



    2 months ago

    Good info, thank you for sharing!