def basic(lcd: lcd2usb.LCD): """Output basic LCD information and datetime.""" bus, dev = lcd.info(False) version = lcd.version now = datetime.datetime.now() lcd.clear() lcd.fill('LCD Version: {0}.{1}'.format(*version), 0) lcd.fill('Bus: {0:x}, Dev: {1:x}'.format(bus, dev), 1) lcd.fill(str(now), 2) lcd.fill_center('win10py3lcd2usb', 3)
ttyActive = False ttyRecentActivity = False ttyCount = 0 time.sleep(0.01) GPIO.setmode(GPIO.BCM) GPIO.setup(26, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) print("launching TTY monitor thread") x = threading.Thread(target=ttyMonitor, args=(1, )) x.start() lcd.info() lcd.clear() lcd.write('Connecting', 0, 0) time.sleep(1) count = 0 ip_address = "" while 1: try: ip_address = ni.ifaddresses('eth0')[ni.AF_INET][0]['addr'] except KeyError: print("netif not yet available\n") print("IP address : ", ip_address) if (ip_address == "10.3.141.2"): lcd.clear() lcd.write('Connected !', 0, 0)
r.append(tmp) udc.append(bytearray(r)) return udc def write_chinese(c, col, row): udc_array = get_udc_array(c) for i in xrange(0, 8): lcd.define_char(i, udc_array[i]) for j in xrange(0, 2): for i in xrange(0, 4): lcd.write(chr(j*4+i), col+i, row+j) lcd = LCD() print lcd.info() print lcd.version lcd.clear() lcd.write('', 0, 0) texts = [u'蒋悦心真棒', u'辛欣真漂亮'] while True: col = 0 row = 0 for text in texts: col = 0 lcd.clear() lcd.write('', 0, 0) for c in text: