def grove_clear(lcd): if device_type == DEVICE_TYPE_MRAA: lcd.clear() elif device_type == DEVICE_TYPE_RPI: lcd.textCommand(0x01) elif device_type == DEVICE_TYPE_GPI: raise NotImplementedError
def outcome(bool): lcd.clear() if bool == 0: lcd.setColor(255,255,0) lcd.write('Success!') else: lcd.setColor(255,0,0) lcd.write('Fatal error :( ')
def timer(): lcd.clear() seconds = 0 while True: lcd.setCursor(0,0) lcd.write('Time elapsed:') lcd.setCursor(1,0) lcd.write('{} Seconds'.format(seconds)) time.sleep(1) seconds += 1
def ChangeLcd(lcd, sensorId, message2): lcd.clear() lcd.home() message1 = "" color = (123, 123, 123) if sensorId == buttonId: message1 = buttonMessage color = buttonColor elif sensorId == touchId: message1 = touchMessage color = touchColor elif sensorId == knobId: message1 = knobMessage color = knobColor elif sensorId == micId: message1 = micMessage color = micColor lcd.setColor(color[0], color[1], color[2]) lcd.write(message1) lcd.setCursor(1, 0) lcd.write(message2)
def write(string,red,green,blue): lcd.clear() lcd.setColor(red,green,blue) lcd.write(string)
import socket import fcntl import struct import pyupm_i2clcd as lcd import time global lcd lcd = lcd.Jhd1313m1(0,0x3E,0x62) lcd.clear() lcd.setCursor(0,0) def timer(): lcd.clear() seconds = 0 while True: lcd.setCursor(0,0) lcd.write('Time elapsed:') lcd.setCursor(1,0) lcd.write('{} Seconds'.format(seconds)) time.sleep(1) seconds += 1 def outcome(bool): lcd.clear() if bool == 0: lcd.setColor(255,255,0) lcd.write('Success!') else: lcd.setColor(255,0,0) lcd.write('Fatal error :( ')
def write(string, r, g, b): # input is assumed to be a list of 4 lcd.clear() # lcd.setcursor(0,0) lcd.setColor(r, g, b) lcd.write(string)