Beispiel #1
0
def tidyup():
    global cyclts
    cyclts = False
    backlight.off()
    lcd.clear()
    lcd.set_contrast(0)
    backlight.set_graph(0)
def toggle_backlight(channel, event):
    global backlight_state
    if backlight_state:
        backlight.off()
        backlight_state = False
    else:
        backlight_state = True
Beispiel #3
0
def clean_up(signal, frame):
    global clock_on
    print "Stopping clock..."
    clock_on = 0
    lcd.set_display_mode(enable=False)
    lcd.clear()
    backlight.off()
    print "Goodbye!"
Beispiel #4
0
def down_button(channel, event):
    global backlight_on
    if backlight_on:
        backlight_on = False
        backlight.off()
    else:
        backlight_on = True
        backlight_rgb(128, 128, 128)
Beispiel #5
0
 def reset():
     lcd.clear()
     backlight.off()
     GVars.LED_RED = 0
     GVars.LED_GREEN = 0
     GVars.LED_BLUE = 0
     backlight.set_graph(0)
     lcd.set_display_mode(enable=True,cursor=False,blink=False)
     lcd.set_contrast(45)
Beispiel #6
0
def system_power(mode='restart'):
    # subprocess isn't quick enough to beat lcd redraw, so disable
    global DO_REDRAW
    DO_REDRAW = 0
    backlight.off()
    lcd.clear()
    if mode == 'restart':
        subprocess.call(['shutdown', '-r', 'now'])
    elif mode == 'shutdown':
        subprocess.call(['shutdown', 'now'])
Beispiel #7
0
def display_show(text1, text2, text3, light):
	print ("display_show")
	
	if light:
		backlight.rgb(0, 100, 0)
	else:
		backlight.off()

	menu.write_row(0, text1)
	menu.write_row(1, text2)
	menu.write_row(2, text3)
Beispiel #8
0
def backlight(data):
    if data["command"] == "off":
        backlight.off()
        return True
    
    if data["command"] == "sweep":
        backlight.sweep(data["hue"],data["range"])
        return True

    if data["command"] == "hue":
        backlight.hue(data["hue"])
        return True
    if data["command"] == "rgb":
        backlight.rgb(data["r"],data["g"],data["b"])
        return True

    if data["command"] == "left_hue":
        backlight.left_hue(data["hue"])
        return True
    if data["command"] == "left_rgb":
        backlight.left_rgb(data["r"],data["g"],data["b"])
        return True

    if data["command"] == "mid_hue":
        backlight.mid_hue(data["hue"])
        return True
    if data["command"] == "mid_rgb":
        backlight.mid_rgb(data["r"],data["g"],data["b"])
        return True

    if data["command"] == "right_hue":
        backlight.right_hue(data["hue"])
        return True
    if data["command"] == "right_rgb":
        backlight.right_rgb(data["r"],data["g"],data["b"])
        return True

    if data["command"] == "set":
        backlight.set(data["index"],data["value"])
        return True

    if data["command"] == "set_bar":
        backlight.set_bar(data["index"],data["value"])
        return True
    if data["command"] == "set_graph":
        backlight.set(data["value"])
        return True

    if data["command"] == "update":
        backlight.update()
        return True
Beispiel #9
0
    def run(self):
        CMPFUNC = CFUNCTYPE(None, c_int, c_int, POINTER(c_ubyte), c_int,
                            c_void_p)
        cmp_func = CMPFUNC(self.callbackfunction)
        lib.tdInit()
        lib.tdRegisterDeviceEvent(cmp_func, 0)

        lcd.clear()
        lcd.set_cursor_position(0, 1)
        lcd.write('Waiting...')
        backlight.off()
        backlight.graph_off()

        print 'Started'
        while True:
            time.sleep(1)
Beispiel #10
0
def handle_button(ch, evt):
    #def handle_button(pin):
    global ButtonStatus
    global loopcount
    if ButtonStatus == 'On':
        loopcount = 10
        lcd.clear()
        backlight.off()
        ButtonStatus = 'Off'
        print "Display Off"
    else:
        loopcount = 0
        backlight.rgb(229, 255, 0)
        display_hostname(0)
        display_NIC(1)
        display_WNIC(2)
        graph_CPUTemp(5)
        ButtonStatus = 'On'
        print "Display Off"
Beispiel #11
0
 def callbackfunction(self, deviceId, method, value, callbackId, context):
     dt = datetime.now()
     sdt = dt.strftime('%Y-%m-%d %H:%M')
     # For some reason the motion sensor sends the same event twice
     if (sdt == self.last_event):
         return
     self.last_event = sdt
     if (deviceId == 7):
         if (method == 1):
             lcd.clear()
             lcd.set_cursor_position(0, 0)
             lcd.write(sdt)
             backlight.rgb(0, 255, 0)
             self.set_leds()
             self.send(sdt)
             print sdt
         if (method == 2):
             lcd.set_cursor_position(0, 1)
             lcd.write('Waiting...')
             backlight.off()
         sys.stdout.flush()
Beispiel #12
0
lcd.set_cursor_position(1, 1)
lcd.write("Santa map: General Asia")

time.sleep(2700)

lcd.clear()
lcd.set_cursor_position(1, 0)
lcd.write("Santa Tracker")
lcd.set_cursor_position(1, 1)
lcd.write("Santa map: General Africa")

time.sleep(1800)

lcd.clear()
lcd.set_cursor_position(1, 0)
lcd.write("Santa Tracker")
lcd.set_cursor_position(1, 1)
lcd.write("Santa map: Turkey")

time.sleep(300)

lcd.clear()
lcd.set_cursor_position(1, 0)
lcd.write("Santa Is Getting Close! Get into bed!")

while True:
    backlight.off()
    backlight.update
    time.sleep(2)
    backlight.rgb(255, 0, 0)
Beispiel #13
0
def tidyup():
    backlight.off()
    lcd.clear()
Beispiel #14
0
    [0,0,0,0,4,0,0,0],
    [0,0,0,0,0,4,0,0],
    [0,0,0,0,0,0,8,0],
    [0,0,0,0,0,0,0,16],
    [0,0,0,0,0,0,0,0]
]

def tidyup():
    backlight.off()
    lcd.clear()

def get_anim_frame(char,fps):
    return char[ int(round(time.time()*fps) % len(char)) ]

backlight.graph_off()
backlight.off()

lcd.set_cursor_position(0,0)
lcd.write(chr(0) * 16)
lcd.set_cursor_position(0,1)
lcd.write(chr(0) * 16)
lcd.set_cursor_position(0,2)
lcd.write(chr(0) * 16)

time.sleep(1)
for x in range(0,255,5):
    backlight.single_rgb(3,x,x,x)

atexit.register(tidyup)

while True:
def reset():
	lcd.clear()
	backlight.graph_off()
	backlight.off()
Beispiel #16
0
def tidyup():
    backlight.off()
    backlight.graph_off()
    lcd.clear()
Beispiel #17
0
def touch_button(channel, event):
    backlight.rgb(*colors[color_choice % len(colors)]['combo'])
    sleep(2)
    backlight.off()
Beispiel #18
0
 def check_timeout(self):
     # check if current time is more than TIMEOUT seconds later than last button press
     if time() - self.last_button_press > self.TIMEOUT:
         # Turn backlight off
         backlight.off()
Beispiel #19
0
def turn_off():
    backlight.off()
    backlight.set_graph(0)
    clear_text()
Beispiel #20
0
def signal_handler(sig, frame):
    backlight.off()
    lcd.clear()
    sys.exit(0)
Beispiel #21
0
def lightsoff():
    global cyclts
    cyclts = False
    backlight.off()
    backlight.set_graph(0)
Beispiel #22
0
 def tidyup(self):
     backlight.off()
     backlight.graph_off()
     lcd.clear()