def main(): lcd.init() lcd.set_contrast(190) lcd.backlight(1) lcd.text("adresses:") ip = subprocess.check_output("hostname -I", shell=True) lcd.locate(0,1) lcd.text(str(ip.strip()) )
def main(): lcd.init() lcd.cls() lcd.data(smiley) lcd.locate(2,2) lcd.data(ch) lcd.locate(3,0) lcd.text("c.a.h.") lcd.backlight(1)
def main(): lcd.init() lcd.cls() lcd.data(smiley) lcd.locate(2, 2) lcd.data(ch) lcd.locate(3, 0) lcd.text("c.a.h.") lcd.backlight(1)
def lcdstatusupdate(sensor_count, i): date = datetime.now() lcd.locate(3, 0) lcd.text(date.strftime('%d/%m/%y')) lcd.locate(3, 1) lcd.text(date.strftime('%H:%M:%S')) lcd.locate(3, 2) lcd.text("sensr: %s" % sensor_count) lcd.locate(3, 3) lcd.text("Next: %s" % i) lcd.locate(3, 4)
def value2lcd(date,id,desc,value): lcd.cls() lcd.locate(0,0) lcd.text(date) lcd.locate(0,1) lcd.text(id) lcd.locate(0,2) lcd.text(desc) lcd.locate(0,3) lcd.text("Temp: %s" % (value)) lcd.locate(0,4)
def stats(): lcd.cls() lcd.locate(0,0) lcd.text(cpu_usage()) lcd.locate(0,1) lcd.text(mem_usage()) lcd.locate(0,2) lcd.text(disk_usage('/')) lcd.locate(0,3) lcd.text(network('eth0')) lcd.locate(0,4)
def value2lcd(date, id, desc, value): lcd.cls() lcd.locate(0, 0) lcd.text(date) lcd.locate(0, 1) lcd.text(id) lcd.locate(0, 2) lcd.text(desc) lcd.locate(0, 3) lcd.text("Temp: %s" % (value)) lcd.locate(0, 4)
def lcdstatusupdate(sensor_count,i): date = datetime.now() lcd.locate(3,0) lcd.text(date.strftime('%d/%m/%y')) lcd.locate(3,1) lcd.text(date.strftime('%H:%M:%S')) lcd.locate(3,2) lcd.text("sensr: %s" % sensor_count) lcd.locate(3,3) lcd.text("Next: %s" % i) lcd.locate(3,4)
def lcd_blink(text): i = 10 lcd.cls() lcd.locate(0, 0) lcd.text(text) lcd.locate(0, 1) while i < 0: lcd.text("after %s sec" % (i)) if i % 2: lcd.backlight(1) else: lcd.backlight(0) i -= 1 time.sleep(1)
def main(): lcd.init() lcd.backlight(1) sample = CpuTemperature() #sample = LoadAverage() buf = RingBuffer(84) while True: current = sample.data() buf.append(current) lcd.image(render(buf)) lcd.locate(0, 0) lcd.text(sample.format(current)) time.sleep(1)
def lcd_blink(text): i=10 lcd.cls() lcd.locate(0,0) lcd.text(text) lcd.locate(0,1) while i<0: lcd.text("after %s sec" % (i)) if i%2: lcd.backlight(1) else: lcd.backlight(0) i-=1 time.sleep(1)
def main(): lcd.init() lcd.backlight(1) sample = CpuTemperature() #sample = LoadAverage() buf = RingBuffer(84) while True: current = sample.data() buf.append(current) lcd.image(render(buf)) lcd.locate(0,0) lcd.text(sample.format(current)) time.sleep(1)
def ifInfo(): global hb lcd.locate(0, 5) st,out = getstatusoutput('ifconfig | grep "inet addr" | grep -v "127.0.0.1"') lineN=2 if out: for line in [x for x in out.split(" ") if ":" in x and "cast" not in x and "addr" in x]: IP=(line.split(':')[1]) lcd.text(IP+" "*(N_COLS-len(IP))) else: if hb: lcd.text(" "*N_COLS) else: lcd.text(" No network ")
def lcd_press(press): MSL = "%07.2f" % float(msl(float(press))) press = "%07.2f" % float(press) if press[0] == "0": digit_0 = " " else: digit_0 = press[0] lcd.locate(1,3) lcd.text("QFE:"+digit_0+press[1:6]) if MSL[0] == "0": digit_0 = " " else: digit_0 = MSL[0] lcd.locate(1,4) lcd.text("QNH:"+digit_0+MSL[1:6])
def write(self, line): ifInfo() self.lines.insert(0,line[0:N_COLS]) if len(self.lines) == 6: self.lines.pop() for i,l in enumerate(self.lines): lcd.locate(0, i) lcd.text(self.lines[4-i]+" "*(N_COLS-len(self.lines[4-i]))) self.hPos = min(len(self.lines[0]), N_COLS-1) else: lcd.locate(self.hPos, self.vPos) lcd.text(self.lines[0]) self.vPos +=1 if self.vPos == 5: self.vPos =4 self.hPos = min(len(self.lines[0]), N_COLS-1)
def display(aToDisplay): aDisplay=[] lcd.cls() sToDisplay='' for sId in aToDisplay.keys(): sToDisplay=sToDisplay+aToDisplay[sId] aDisplay=splitLineForLCD(sToDisplay,LCD_COLUMNS) y=0 while len(aDisplay)>0: sLine=aDisplay.pop(0) lcd.text(sLine) y=y+1 if y >= LCD_LINES: y=0 time.sleep(5) lcd.cls() lcd.locate(0,y)
def display(aToDisplay): aDisplay = [] lcd.cls() sToDisplay = '' for sId in aToDisplay.keys(): sToDisplay = sToDisplay + aToDisplay[sId] aDisplay = splitLineForLCD(sToDisplay, LCD_COLUMNS) y = 0 while len(aDisplay) > 0: sLine = aDisplay.pop(0) lcd.text(sLine) y = y + 1 if y >= LCD_LINES: y = 0 time.sleep(5) lcd.cls() lcd.locate(0, y)
def demo(seconds): lcd.cls() lcd.text("Hello world!") lcd.locate(0, 4) lcd.text("Charlotte :-)") for loop in range(seconds * 4): lcd.locate(0, 1) lcd.text(time.strftime("%d %b %Y", time.localtime())) lcd.locate(0, 2) lcd.text(time.strftime("%H:%M:%S", time.localtime())) time.sleep(0.25)
def demo(): lcd.locate(0,0) lcd.data(logo)
#!/usr/bin/env python import pcd8544.lcd as lcd import sys backlight={'ON':0,'OFF':1} if __name__ == "__main__": lcd.init() lcd.set_contrast(180) if sys.argv[1] == 'text': lcd.locate(int(sys.argv[2]),int(sys.argv[3])) lcd.text(sys.argv[4]) if sys.argv[1] == 'backlight': lcd.backlight(backlight[sys.argv[2].upper()]) if sys.argv[1] == 'cls': lcd.cls()
def blinkCursor(self, hb): lcd.locate(self.hPos, self.vPos) if hb: lcd.text(CURSOR) else: lcd.text(" ")
def stats(): lcd.text("adresses:") lcd.locate(0,0)
#!/usr/bin/env python import pcd8544.lcd as lcd import sys backlight = {'ON': 0, 'OFF': 1} if __name__ == "__main__": lcd.init() lcd.set_contrast(180) if sys.argv[1] == 'text': lcd.locate(int(sys.argv[2]), int(sys.argv[3])) lcd.text(sys.argv[4]) if sys.argv[1] == 'backlight': lcd.backlight(backlight[sys.argv[2].upper()]) if sys.argv[1] == 'cls': lcd.cls()
def demo(): lcd.locate(0,0) lcd.text(list(map(chr, list(range(0x20, 0x74)))))
def display_song_meta(text, **kwargs): lcd.locate(0, 0) bitmap = get_bitmap(text, **kwargs) lcd.data(bitmap)
def demo(): lcd.locate(0, 0) lcd.data(logo)
def demo(): lcd.locate(0, 0) lcd.text(map(chr, range(0x20, 0x74)))
def display_banner(): lcd.locate(0, 5) lcd.text(' @wolfg1969 ')
def lcd_temp(temp): lcd.locate(1,2) lcd.text(temp) lcd.text('.', special_FONT) lcd.text('C')
def lcd_time(ltime): lcd.locate(1,1) lcd.text(ltime[11:19])
def lcd_date(date): lcd.locate(1,0) # Date in database is ISO format yyyy-mm-dd # Date displayed is EUR format dd/mm/yyyy lcd.text(date[8:10]+"/"+date[5:7]+"/"+date[0:4])
def display_volume_bar(volume='-24.375000'): lcd.locate(0, 4) lcd.data(get_volume_bar_data(volume))