def __init__(self): threading.Thread.__init__(self) self.val = "" self.ser = serial self.mess1 = "hello" self.mess2 = "World!" self.ser = serial.Serial("/dev/ttyUSB0", 500000, timeout=0) self.ctx = ScreenContext("/dev/ttyUSB0") self.ctx.sleep(6).reset_lcd().set_rotation(1) self.counter = 0 #print "rows", ctx.get_rows(), 320/ctx.get_rows() #print "columns", ctx.get_columns() self.row = 21 * 2 * 8 print "Start LCD"
class Thread_Manager(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.val = "" self.ser = serial self.mess1 = "hello" self.mess2 = "World!" self.ser = serial.Serial("/dev/ttyUSB0", 500000, timeout=0) self.ctx = ScreenContext("/dev/ttyUSB0") self.ctx.sleep(6).reset_lcd().set_rotation(1) self.counter = 0 #print "rows", ctx.get_rows(), 320/ctx.get_rows() #print "columns", ctx.get_columns() self.row = 21 * 2 * 8 print "Start LCD" def run(self): while True: header = Header() header.render_header(self.ctx,0,"HeaderName") self.ctx.fg_color(Screen.RED).write(self.mess1).linebreak() self.ctx.fg_color(Screen.RED).write(str(self.counter)).linebreak() self.ctx.fg_color(Screen.BLUE).write(self.mess2) #ctx.fg_color(Screen.BLUE).write(ReadThread.returnPress()) self.ctx.set_cursor_pos(self.row * 3,0) self.counter += 1 #def update_screen(self): # self.ctx.sleep(6).reset_lcd().set_rotation(1) # header = Header() # header.render_header(self.ctx,0,"Rouge") # self.ctx.fg_color(Screen.RED).write(self.mess1).linebreak() # self.ctx.fg_color(Screen.RED).write(str(self.counter)).linebreak() # self.ctx.fg_color(Screen.BLUE).write(self.mess2) # #ctx.fg_color(Screen.BLUE).write(ReadThread.returnPress()) # self.ctx.set_cursor_pos(self.row * 3,0) # self.counter += 1 def update_message(self, mess1, mess2): self.mess1 = mess1 self.mess2 = mess2 return True
class Thread_Manager(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.val = "" self.ser = serial self.mess1 = "hello" self.mess2 = "World!" self.ser = serial.Serial("/dev/ttyUSB0", 500000, timeout=0) self.ctx = ScreenContext("/dev/ttyUSB0") self.ctx.sleep(6).reset_lcd().set_rotation(1) self.counter = 0 #print "rows", ctx.get_rows(), 320/ctx.get_rows() #print "columns", ctx.get_columns() self.row = 21 * 2 * 8 print "Start LCD" def run(self): while True: header = Header() header.render_header(self.ctx, 0, "HeaderName") self.ctx.fg_color(Screen.RED).write(self.mess1).linebreak() self.ctx.fg_color(Screen.RED).write(str(self.counter)).linebreak() self.ctx.fg_color(Screen.BLUE).write(self.mess2) #ctx.fg_color(Screen.BLUE).write(ReadThread.returnPress()) self.ctx.set_cursor_pos(self.row * 3, 0) self.counter += 1 #def update_screen(self): # self.ctx.sleep(6).reset_lcd().set_rotation(1) # header = Header() # header.render_header(self.ctx,0,"Rouge") # self.ctx.fg_color(Screen.RED).write(self.mess1).linebreak() # self.ctx.fg_color(Screen.RED).write(str(self.counter)).linebreak() # self.ctx.fg_color(Screen.BLUE).write(self.mess2) # #ctx.fg_color(Screen.BLUE).write(ReadThread.returnPress()) # self.ctx.set_cursor_pos(self.row * 3,0) # self.counter += 1 def update_message(self, mess1, mess2): self.mess1 = mess1 self.mess2 = mess2 return True
import datetime import time import serial import datetime import os import csv import deepdish as dd import time import uuid import subprocess from getmac import get_mac_address from mintsXU4 import mintsLatest as mL from mintsXU4 import mintsDefinitions as mD dataFolder = mD.dataFolder ctx = ScreenContext(mD.show2Port) atexit.register(ctx.cleanup) macAddress = mD.macAddress def main(): preVal = "-----" pm1 = preVal pm2_5 = preVal pm10 = preVal temperature = preVal humidity = preVal pressure = preVal maxTemperature = preVal
parser.add_argument( "--port", "-p", help="serial port to use as the output (default=/dev/ttyUSB0)", type=str, default="/dev/ttyUSB0") args = parser.parse_args() # Apply the arguments default_tab = args.tab - 1 tab_change_interval = args.time tabs = config.tabs current_tab = default_tab ctx = ScreenContext(args.port) atexit.register(ctx.cleanup) # Wait 6 seconds for the screen to boot up before we start uploading anything ctx.sleep(6).reset_lcd().set_rotation(0) # Header header = Header() print "Started" time_since_tab_change = 0 last_time = time.time() while True:
parser.add_argument("--time", "-T", help="for how many seconds should a tab be shown before changing it (default=15)", type=int, default=15) parser.add_argument("--port", "-p", help="serial port to use as the output (default=/dev/ttyUSB0)", type=str, default="/dev/ttyUSB0") args = parser.parse_args() # Apply the arguments default_tab = args.tab - 1 tab_change_interval = args.time tabs = config.tabs current_tab = default_tab ctx = ScreenContext(args.port) atexit.register(ctx.cleanup) # Wait 6 seconds for the screen to boot up before we start uploading anything ctx.sleep(6).reset_lcd().set_rotation(0) # Header header = Header() print "Started" time_since_tab_change = 0 last_time = time.time() while True: