def status_wifite(sWhat,sValue): if 'rab' in aToDisplay: del aToDisplay['rab'] if sWhat=='Cracked': try: # sValue is the AP's ssid sKey=str(client.read('/cracked/from_reboot/'+sValue).value) except KeyError: print 'No key for AP "'+sValue+'"' except: print 'Unexpected error:',sys.exec_info()[0] else: lcd.backlight(ON) aToDisplay[sValue]=">"+sValue+':'+sKey+"\n" if 'wifite' in aToDisplay: del aToDisplay['wifite'] elif sWhat == 'Attacking': aToDisplay['wifite']="Attacking:\n"+sValue+"\n" elif sWhat == 'Start cracking': aWStatus=string.split(str(client.read('/wifite/status').value),':') aToDisplay['wifite']="Cracking:\n"+sValue+"\n"+aWStatus[1]+"\n" else: # Wifite status aToDisplay['wifite']=sValue+"\n" return aToDisplay
def status_wifite(sWhat, sValue): if 'rab' in aToDisplay: del aToDisplay['rab'] if sWhat == 'Cracked': try: # sValue is the AP's ssid sKey = str(client.read('/cracked/from_reboot/' + sValue).value) except KeyError: print 'No key for AP "' + sValue + '"' except: print 'Unexpected error:', sys.exec_info()[0] else: lcd.backlight(ON) aToDisplay[sValue] = ">" + sValue + ':' + sKey + "\n" if 'wifite' in aToDisplay: del aToDisplay['wifite'] elif sWhat == 'Attacking': aToDisplay['wifite'] = "Attacking:\n" + sValue + "\n" elif sWhat == 'Start cracking': aWStatus = string.split(str(client.read('/wifite/status').value), ':') aToDisplay[ 'wifite'] = "Cracking:\n" + sValue + "\n" + aWStatus[1] + "\n" else: # Wifite status aToDisplay['wifite'] = sValue + "\n" return aToDisplay
def init(): lcd.init() lcd.cls() lcd.backlight(ON) wiringpi.pinMode(BUTTON_OK,INPUT) wiringpi.pinMode(BUTTON_FKEY,INPUT)
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 main(): while 1: try: # Run main Client activity client = Client() client.run() except KeyboardInterrupt: # If Ctrl+C has been pressed # turn off the lcd backlight lcd.cls() lcd.backlight(0); # Exit from the program sys.exit(0)
def main(): while 1: try: # Run main Client activity client = Client() client.run() except KeyboardInterrupt: # If Ctrl+C has been pressed # turn off the lcd backlight lcd.cls() lcd.backlight(0) # Exit from the program sys.exit(0)
def main(): try: # Create a Client object client = Client() # Run it client.run() except KeyboardInterrupt: # if Ctrl+C has been pressed # turn off the lcd backlight lcd.backlight(0) lcd.cls() # exit from the program sys.exit(0)
def main(): try: # Create a Client object client = Client() # Run it client.run() except KeyboardInterrupt: # if Ctrl+C has been pressed # turn off the lcd backlight lcd.backlight(0); lcd.cls() # exit from the program sys.exit(0)
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 send_to_display(fields, **kwargs): artist=fields[0] title=fields[1] volume = fields[6] text = u"{artist} {title}".format(artist=artist, title=title, ) lcd.backlight(not is_night()) # lcd.backlight(1) display_song_meta(text, **kwargs) display_volume_bar(volume) display_banner()
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 on_data(self, data): jdata = json.loads(data) try: if jdata['event'] == "favorite": if jdata['source']['id'] != me.id: ### Eject. lcd.backlight(ON) putstr("@" + jdata['source']['screen_name'], 0, 4) putstr("favorited!! ", 0, 5) showlogo(1) os.system('eject -T /dev/sr0') # os.system('eject -T /dev/sr0') time.sleep(5) clearline(1, 5) lcd.backlight(OFF) except KeyError: pass try: if (-1 < jdata['text'].find("@eject_ug")): lcd.backlight(ON) showlogo(1) putstr("@" + jdata['user']['screen_name'], 0, 4) putstr("mentioned!! ", 0, 5) os.system('eject -T /dev/sr0') # os.system('eject -T /dev/sr0') time.sleep(5) if (-1 < jdata['text'].find("IP")): putstr(str(os.popen("hostname -I").read()), 0, 5) time.sleep(5) clearline(1, 5) lcd.backlight(OFF) except KeyError: pass
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 run(self): while True: try: # Loop Clock / Temperature interchangeably # for 10 seconds each client = Clock() client.run() time.sleep(10) lcd.cls() client2 = Process() client2.run() time.sleep(10) lcd.cls() except KeyboardInterrupt: lcd.backlight(0); lcd.cls() sys.exit(0)
def run(self): while True: try: # Loop Clock / Temperature interchangeably # for 10 seconds each client = Clock() client.run() time.sleep(10) lcd.cls() client2 = Process() client2.run() time.sleep(10) lcd.cls() except KeyboardInterrupt: lcd.backlight(0) lcd.cls() sys.exit(0)
pass def on_error(self, status_code): print >> sys.stderr, 'Encountered error with status code:', status_code putstr("Error: " + str(status_code), 0, 5) return True # Don't kill the stream def on_timeout(self): print >> sys.stderr, 'Timeout...' putstr("Error: Timeout", 0, 5) return True # Don't kill the stream try: lcd.init() lcd.cls() lcd.backlight(ON) putstr("Wearable Eject", 0, 0) putstr("Starting", 0, 5) auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_key, access_secret) api = tweepy.API(auth) putstr("Connect twtr.", 0, 5) me = api.me() putstr("Get profile. ", 0, 5) sapi = tweepy.streaming.Stream(auth, CustomStreamListener()) putstr("Start stream.", 0, 5) lcd.backlight(OFF) sapi.userstream()
# Application starts here #!/usr/bin/python import pcd8544.lcd as lcd import time, sys ,os, subprocess from datetime import datetime # optional load of drivers if not listed in /etc/modules #os.system('modprobe w1-gpio') #os.system('modprobe w1-therm') #Initiate LCD lcd.init() # Turn backlight on/off. The number corrensponds to backlight # brightness, 0 being light off, 10 being the brightest. lcd.backlight(5) lcd.set_contrast(512) # Prepare degrees celsius symbol lcd.define_custom_char([0x00, 0x07, 0x05, 0x07, 0x00]) def get_temp(file): # The '28-xxx' in the file name should be changed accordingly # to name in your /sys/bus/w1/devices folder. file = "/sys/bus/w1/devices/28-000004e4b880/w1_slave" # Open file written to by temp sensor tfile = open(file) # Read all text in file text = tfile.read() # Close file once text is read tfile.close() # Pull out the temperature value
#!/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()
else: s += " " s += "+\n" for x in range(self.width): if self.data[self.offset(x, y)] & WEST != 0: s += "|" else: s += " " s += " " s += "|\n" s += "+---" * self.width s += "+\n" return s def demo(iterations): screen = (84, 48) for loop in range(iterations): for scale in [2, 3, 4, 3]: sz = map(lambda z: z / scale - 1, screen) im = Maze(sz).to_image(lambda z: z * scale) lcd.image(im) time.sleep(1) if __name__ == "__main__": lcd.init() lcd.backlight(1) demo(20)
def __init__(self): # Initialize LCD lcd.init() # Turn the backlight on/off and adjust it lcd.backlight(0)
0xE0, 0xFC, 0xFE, 0xFF, 0xF3, 0x38, 0x38, 0x0C, 0x0E, 0x0F, 0x0F, 0x0F, 0x0E, 0x3C, 0x38, 0xF8, # 0x00D0 (208) pixels 0xF8, 0x38, 0x3C, 0x0E, 0x0F, 0x0F, 0x0F, 0x0E, 0x0C, 0x38, 0x38, 0xF3, 0xFF, 0xFF, 0xF8, 0xE0, # 0x00E0 (224) pixels 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # 0x00F0 (240) pixels 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # 0x0100 (256) pixels 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # 0x0110 (272) pixels 0x00, 0x7F, 0xFF, 0xE7, 0xC3, 0xC1, 0xE0, 0xFF, 0xFF, 0x78, 0xE0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, # 0x0120 (288) pixels 0x60, 0x78, 0x38, 0x3F, 0x3F, 0x38, 0x38, 0x60, 0x60, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, 0xF8, 0x7F, # 0x0130 (304) pixels 0xFF, 0xE0, 0xC1, 0xC3, 0xE7, 0x7F, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # 0x0140 (320) pixels 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # 0x0150 (336) pixels 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # 0x0160 (352) pixels 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0F, 0x7F, 0xFF, 0xF1, 0xE0, 0xC0, 0x80, 0x01, # 0x0170 (368) pixels 0x03, 0x9F, 0xFF, 0xF0, 0xE0, 0xE0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, 0xE0, 0xF0, 0xFF, 0x9F, # 0x0180 (384) pixels 0x03, 0x01, 0x80, 0xC0, 0xE0, 0xF1, 0x7F, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # 0x0190 (400) pixels 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # 0x01A0 (416) pixels 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # 0x01B0 (432) pixels 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, # 0x01C0 (448) pixels 0x03, 0x03, 0x07, 0x07, 0x0F, 0x1F, 0x1F, 0x3F, 0x3B, 0x71, 0x60, 0x60, 0x60, 0x60, 0x60, 0x71, # 0x01D0 (464) pixels 0x3B, 0x1F, 0x0F, 0x0F, 0x0F, 0x07, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # 0x01E0 (480) pixels 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # 0x01F0 (496) pixels 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ] def demo(): lcd.locate(0,0) lcd.data(logo) if __name__ == "__main__": lcd.init() lcd.backlight(1) demo()
lcd.centre_text(1,actions.get_text(current)) def main_loop(): global current display_main_screen() while 1: key = wiringpi.digitalRead(BUTTON_OK) fkey = wiringpi.digitalRead(BUTTON_FKEY) if key == 1: #photo.take_sync_photo(comm_server, lcd) actions.run_command(current, comm_server, lcd) display_main_screen() if fkey == 1: print('fkey') current=(current+1)%actions.get_count() display_main_screen() time.sleep(0.2) try: init() main_loop() finally: for i in range(256,0,-16): lcd.set_brightness(i) time.sleep(0.025) lcd.cls() lcd.backlight(OFF)
def main(): lcd.init() lcd.backlight(1) stats()
#!/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 __init__(self): lcd.init() lcd.backlight(1) lcd.cls()
else: try: recent = playList[-1] except: print("fail get list") continue #lcd.init() # New b-w image im = Image.new('1', (84,48)) # New drawable on image draw = ImageDraw.Draw(im) lcd.cls() lcd.backlight(0) rTitle = str(ch[int(recent['channel']['channelId'])][1]) rAddress = str(ch[int(recent['channel']['channelId'])][0]) song = recent['title'] title = recent['artistName'] draw.text((0,-2), rTitle, fill=1, font=font) draw.text((0,10), rAddress, fill=1, font=font) draw.text((0,20), song, fill=1, font=font) draw.text((0,30), title, fill=1, font=font) # Copy it to the display lcd.show_image(im) # clean up del draw del im
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ] def demo(): lcd.locate(0, 0) lcd.data(logo) if __name__ == "__main__": lcd.init() lcd.backlight(0) lcd.set_contrast(190) demo()