def waiting_lcd(): lcd = lcddriver.lcd() #clear the lcd lcd.lcd_clear() #writing each line lcd.lcd_display_string("Waiting...", 1)
def __init__(self): self.Lcd = LcdDisplayLib.lcd() self.Lcd.lcd_clear() self.Cycle = [] self.OverideMsg = False self._Timer = None self._OfsetCount = 0 # thread acces only
def detected_lcd(): lcd = lcddriver.lcd() #clear the lcd lcd.lcd_clear() #writing each line lcd.lcd_display_string("Detected a", 1) lcd.lcd_display_string("weight change!", 2)
def startup_lcd(): lcd = lcddriver.lcd() #clear the lcd lcd.lcd_clear() #writing each line lcd.lcd_display_string("Turnip the Beets", 1) lcd.lcd_display_string("is initalizing...", 2)
def classified_lcd(label, mass): lcd = lcddriver.lcd() #clear the lcd lcd.lcd_clear() #writing each line lcd.lcd_display_string("Found a:", 1) lcd.lcd_display_string("{}".format(label), 2) lcd.lcd_display_string("mass:", 3) lcd.lcd_display_string("{} g".format(mass), 4)
debug = True if '--nodisplay' in argv: display = False if '-l' in argv: logging = True with open('settings.json') as f: config = json.loads(f.read()) if config['logging'] and logging == None: logging = config['logging'] if config['display']['width']: displaywidth = config['display']['width'] if display: from lib import lcddriver lcd = lcddriver.lcd(int(config['display']['address'], 16)) lcd.lcd_clear() def get_data(): global subs, views, s_subs, time, s_delta, v_views, v_delta headers = { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' } url = 'https://www.googleapis.com/youtube/v3/channels?part=snippet%2CcontentDetails%2Cstatistics&forUsername={}&key={}'.format( arg_user if arg_user != None else config['channel'], config['key']) ytdata = json.loads(requests.get( url, headers=headers).text)['items'][0]['statistics']
def errorclass_lcd(): lcd = lcddriver.lcd() #clear the lcd lcd.lcd_clear() #writing each line lcd.lcd_display_string("Failed to classify :(", 1)
def clear_lcd(): lcd = lcddriver.lcd() #clear the lcd lcd.lcd_clear()
def set_servo_pulse(channel, pulse): pulse_length = 1000000 # 1,000,000 us per second pulse_length //= 60 # 60 Hz print('{0}us per period'.format(pulse_length)) pulse_length //= 4096 # 12 bits of resolution print('{0}us per bit'.format(pulse_length)) pulse *= 1000 pulse //= pulse_length pwm.set_pwm(channel, 0, pulse) # Main Application try: lcdView = deque(['', '', '', '']) lcd = lcddriver.lcd() lcd.lcd_clear() writeDebug("henOS starting up") writeDebug(datetime.now().strftime("%Y-%m-%d %H:%M:%S")) except: print("Could not access display") # Use netifaces to get the IP try: addrs = netifaces.ifaddresses('wlan0') writeDebug("wlan0:" + str(addrs[netifaces.AF_INET][0]["addr"])) except: print("Could not access wlan interface") if __name__ == '__main__': app.run(host='0.0.0.0', port=int("80"), debug=True)