Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sense_hat import SenseHat
- import time
- s = SenseHat()
- s.low_light = True
- green = (0, 255, 0)
- yellow = (255, 255, 0)
- blue = (0, 0, 255)
- red = (255, 0, 0)
- white = (255,255,255)
- nothing = (0,0,0)
- pink = (255,105, 180)
- def printRainbow():
- red=(255,0,0)
- green=(0,255,0)
- img=[]
- for x in range(1,9):
- for y in range(1,9):
- if ((x+y)%2==0):
- color=red
- else:
- color=green
- # color=(x*5,y*5, 200)
- # img[x*8+y]=color
- img.append(color)
- s.set_pixels(img)
- def printStripes(seq):
- red=(255,0,0)
- green=(0,255,0)
- img=[]
- for x in range(1,9):
- for y in range(1,9):
- color=green
- if (seq==1):
- if (abs(x-y)==x-y):
- color=red;
- else:
- if (abs(x-y)==y-x):
- color=red;
- img.append(color)
- s.set_pixels(img)
- def trinket_logo():
- G = green
- Y = yellow
- B = blue
- O = nothing
- logo = [
- O, O, O, O, O, O, O, O,
- O, Y, Y, Y, B, G, O, O,
- Y, Y, Y, Y, Y, B, G, O,
- Y, Y, Y, Y, Y, B, G, O,
- Y, Y, Y, Y, Y, B, G, O,
- Y, Y, Y, Y, Y, B, G, O,
- O, Y, Y, Y, B, G, O, O,
- O, O, O, O, O, O, O, O,
- ]
- return logo
- def raspi_logo():
- G = green
- R = red
- O = nothing
- logo = [
- O, G, G, O, O, G, G, O,
- O, O, G, G, G, G, O, O,
- O, O, R, R, R, R, O, O,
- O, R, R, R, R, R, R, O,
- R, R, R, R, R, R, R, R,
- R, R, R, R, R, R, R, R,
- O, R, R, R, R, R, R, O,
- O, O, R, R, R, R, O, O,
- ]
- return logo
- def plus():
- W = white
- O = nothing
- logo = [
- O, O, O, O, O, O, O, O,
- O, O, O, W, W, O, O, O,
- O, O, O, W, W, O, O, O,
- O, W, W, W, W, W, W, O,
- O, W, W, W, W, W, W, O,
- O, O, O, W, W, O, O, O,
- O, O, O, W, W, O, O, O,
- O, O, O, O, O, O, O, O,
- ]
- return logo
- def equals():
- W = white
- O = nothing
- logo = [
- O, O, O, O, O, O, O, O,
- O, W, W, W, W, W, W, O,
- O, W, W, W, W, W, W, O,
- O, O, O, O, O, O, O, O,
- O, O, O, O, O, O, O, O,
- O, W, W, W, W, W, W, O,
- O, W, W, W, W, W, W, O,
- O, O, O, O, O, O, O, O,
- ]
- return logo
- def heart():
- P = pink
- O = nothing
- logo = [
- O, O, O, O, O, O, O, O,
- O, P, P, O, P, P, O, O,
- P, P, P, P, P, P, P, O,
- P, P, P, P, P, P, P, O,
- O, P, P, P, P, P, O, O,
- O, O, P, P, P, O, O, O,
- O, O, O, P, O, O, O, O,
- O, O, O, O, O, O, O, O,
- ]
- return logo
- images = [trinket_logo, trinket_logo, plus, raspi_logo, raspi_logo, equals, heart, heart]
- count = 0
- #while True:
- sense=SenseHat()
- printRainbow()
- time.sleep(2)
- for x in range(1,10):
- printStripes(x%2+1)
- temp=round(sense.get_temperature(),2)
- print(temp)
- time.sleep(1)
- #printStripes(2)
- # s.set_pixels(images[count % len(images)]())
- # time.sleep(.75)
- # count += 1
Advertisement
Add Comment
Please, Sign In to add comment