jkutzsch
Posts: 1
Joined: Wed Oct 28, 2015 5:57 am

New SenseHat, is it working?

Wed Oct 28, 2015 6:13 am

2 questions,

1. what is the best way to test that my new SenseHat is actually working/doesn't have a physical issue?
2. are there instructions for specifically adding gpio pins to the SenseHat?

Thank you.

User avatar
Kratos
Posts: 395
Joined: Sun Apr 12, 2015 12:41 pm

Re: New SenseHat, is it working?

Wed Oct 28, 2015 5:50 pm

Try doing this.
1. Type

Code: Select all

sudo nano test.py
2. Paste this into it

Code: Select all

#!/usr/bin/python
import time
from sense_hat import SenseHat

sense = SenseHat()
r = 255
g = 0
b = 0

while True:

    msleep = lambda x: time.sleep(x / 100.0)


    def next_colour():
        global r
        global g
        global b

        if (r == 255 and g < 255 and b == 0):
            g += 1

        if (g == 255 and r > 0 and b == 0):
            r -= 1

        if (g == 255 and b < 255 and r == 0):
            b += 1

        if (b == 255 and g > 0 and r == 0):
            g -= 1

        if (b == 255 and r < 255 and g == 0):
            r += 1

        if (r == 255 and b > 0 and g == 0):
            b -= 1

    sense.clear([r, g, b])
    msleep(2)
    next_colour()
2. Run it with

Code: Select all

sudo python3 test.py
3.You should see the LEDS light up :D .

As far as adding GPIO pins to the HAT, I couldn't help you :( .
Hope this helps! :ugeek:
NOTE: This program is not mine. It's copied off of the internet

Kratos
I have posted mostly with a Pi 2 running either Ubuntu MATE, or Raspbian.

plugwash
Forum Moderator
Forum Moderator
Posts: 3602
Joined: Wed Dec 28, 2011 11:45 pm

Re: New SenseHat, is it working?

Wed Oct 28, 2015 7:11 pm

If you want to add pins to the top of the sense hat so you can get at the IO then you need to pull the black connector out from the bottom of the sense hat and replace it with one that has longer pins.

https://shop.pimoroni.com/products/2x20 ... wgodBEEI1Q

Return to “Astro Pi”