Exemple #1
0
def display_messages(messages):
    LEDMatrix.init()
    try:
        LEDMatrix.brightness(3)
        LEDMatrix.scroll_message_horiz([messages])
        LEDMatrix.clear_all()
    except KeyboardInterrupt:
        LEDMatrix.scroll_message_horiz(["", "Have a good PyDay!", ""], 1, 8)
    LEDMatrix.clear_all()
Exemple #2
0
def warn():
    a = 0
    b = 1
    sad = [[b, b, b, b, b, b, b, b], [b, a, b, b, b, b, b, b],
           [b, b, a, b, b, a, b, b], [b, b, a, b, b, b, b, b],
           [b, b, a, b, b, b, b, b], [b, b, a, b, b, a, b, b],
           [b, a, b, b, b, b, b, b], [b, b, b, b, b, b, b, b]]
    LEDMatrix.gfx_sprite_array(sad, start_x=0, start_y=0, state=GFX_INVERT)
    LEDMatrix.gfx_scroll_towards(new_graphic=GFX_OFF,
                                 repeats=3,
                                 speed=5,
                                 direction=DIR_L,
                                 finish=True)
    LEDMatrix.gfx_render()
    LEDMatrix.gfx_render()
    LEDMatrix.gfx_render()
    time.sleep(1)
    LEDMatrix.clear_all()
    LEDMatrix.scroll_message_horiz(["warning"], 1, 5)
    while True:
        for row in cur.fetchall():
            mq2 = str(row[0])
            mq7 = str(row[1])
            mq131 = str(row[2])
            mq135 = str(row[3])
            mq136 = str(row[4])
            pm1 = str(row[5])
            pm25 = str(row[6])
            pm10 = str(row[7])
            print(mq2)
            print(mq7)
            print(mq131)
            print(mq135)
            print(mq136)

            LEDMatrix.scroll_message_horiz(["LPG: 2100"], 1, 5)
            time.sleep(1)
            LEDMatrix.clear_all()
Exemple #3
0
def normal():
    # Display a stationary message
    a = 1
    b = 0
    ##happy=[[0,0,1,1,1,1,0,0],[0,1,0,1,0,0,1,0],[1,0,1,0,0,1,0,1],[1,0,1,0,0,0,0,1],[1,0,1,0,0,0,0,1],[1,0,1,0,0,1,0,1],[0,1,0,1,0,0,1,0],[0,0,1,1,1,1,0,0]]
    happy = [[b, b, b, b, b, b, b, b], [b, b, a, b, b, b, b, b],
             [b, a, b, b, b, a, b, b], [b, a, b, b, b, b, b, b],
             [b, a, b, b, b, b, b, b], [b, a, b, b, b, a, b, b],
             [b, b, a, b, b, b, b, b], [b, b, b, b, b, b, b, b]]
    LEDMatrix.gfx_sprite_array(happy, start_x=0, start_y=0, state=GFX_INVERT)
    LEDMatrix.gfx_scroll_towards(new_graphic=GFX_OFF,
                                 repeats=3,
                                 speed=5,
                                 direction=DIR_L,
                                 finish=True)
    LEDMatrix.gfx_render()
    time.sleep(1)
    LEDMatrix.clear_all()
    while True:
        for row in cur.fetchall():
            mq2 = str(row[0])
            mq7 = str(row[1])
            mq131 = str(row[2])
            mq135 = str(row[3])
            mq136 = str(row[4])
            pm1 = str(row[5])
            pm25 = str(row[6])
            pm10 = str(row[7])
            print(mq2)
            print(mq7)
            print(mq131)
            print(mq135)
            print(mq136)

            LEDMatrix.scroll_message_horiz(["LPG: " + mq2], 1, 5)
            LEDMatrix.scroll_message_horiz(["CO: " + mq7], 1, 5)
            LEDMatrix.scroll_message_horiz(["NOx: " + mq131], 1, 5)
            LEDMatrix.scroll_message_horiz(["HAZ: " + mq135], 1, 5)
            LEDMatrix.scroll_message_horiz(["H2S: " + mq136], 1, 5)
            LEDMatrix.scroll_message_horiz(["PM1.0: " + pm1], 1, 5)
            LEDMatrix.scroll_message_horiz(["PM2.5: " + pm25], 1, 5)
            LEDMatrix.scroll_message_horiz(["PM10: " + pm10], 1, 5)
            time.sleep(1)
            LEDMatrix.clear_all()
Exemple #4
0
            mq131 = str(row[2])
            mq135 = str(row[3])
            mq136 = str(row[4])
            pm1 = str(row[5])
            pm25 = str(row[6])
            pm10 = str(row[7])
            print(mq2)
            print(mq7)
            print(mq131)
            print(mq135)
            print(mq136)

            LEDMatrix.scroll_message_horiz(["LPG: " + mq2], 1, 5)
            LEDMatrix.scroll_message_horiz(["CO: " + mq7], 1, 5)
            LEDMatrix.scroll_message_horiz(["NOx: " + mq131], 1, 5)
            LEDMatrix.scroll_message_horiz(["HAZ: " + mq135], 1, 5)
            LEDMatrix.scroll_message_horiz(["H2S: " + mq136], 1, 5)
            LEDMatrix.scroll_message_horiz(["PM1.0: " + pm1], 1, 5)
            LEDMatrix.scroll_message_horiz(["PM2.5: " + pm25], 1, 5)
            LEDMatrix.scroll_message_horiz(["PM10: " + pm10], 1, 5)
            time.sleep(1)
            LEDMatrix.clear_all()


try:
    warn()
except KeyboardInterrupt:
    # reset array
    LEDMatrix.scroll_message_horiz(["Goodbye!"], 1, 6)
    LEDMatrix.clear_all()
Exemple #5
0
	Floors = ["B", "G", "1", "2"]
	LEDMatrix.static_message("Floor: " + Floors[0])
	time.sleep(1)
	for floor, display in enumerate(Floors[:-1]):
		for stage in range(8):
			LEDMatrix.send_matrix_shifted_letter(3, ord(display), ord(Floors[floor+1]), stage, DIR_D)
			time.sleep(0.1)
	LEDMatrix.static_message("Floor: " + Floors[-1])
	time.sleep(1)
	LEDMatrix.clear_all()

	# Horizontally scroll and repeat a long message
	for dir in [DIR_L, DIR_R]:
		for speed in [3,6,9]:
			texts = [""] * (speed//3-1) +["Speed:"+chr(48+speed)+" ", "", ""]
			LEDMatrix.scroll_message_horiz(texts, speed//3 , speed, dir)
	time.sleep(1)

	# Vertically transition (scroll) between different messages
	for speed in [3,6,9]:
		LEDMatrix.static_message("Speed: "+chr(48+speed))
		time.sleep(1)
		LEDMatrix.scroll_message_vert("Speed: "+chr(48+speed), "Message 2",speed, DIR_U)
		time.sleep(0.25)
		LEDMatrix.scroll_message_vert("Message 2", "Message 3", speed, DIR_U)
		time.sleep(0.25)
		LEDMatrix.scroll_message_vert("Message 3", "Speed: "+chr(48+speed), speed, DIR_U)
		time.sleep(1)
		LEDMatrix.scroll_message_vert("Speed: "+chr(48+speed), "Message 5", speed, DIR_D)
		time.sleep(0.25)
		LEDMatrix.scroll_message_vert("Message 5", "Message 6", speed, DIR_D)