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.
Code: Select all
sudo nano test.pyCode: 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()
Code: Select all
sudo python3 test.py