Advertisement
Guest User

lcdF.py

a guest
Jan 18th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.19 KB | None | 0 0
  1. import time
  2. from datetime import datetime
  3. from engine.lib import lcd, temp
  4.  
  5. config = lcd.LCD()
  6.  
  7. def printWelcome():
  8.     config.lcd_clear()
  9.     config.lcd_display_string("System", 1)
  10.     config.lcd_display_string("aktywny", 2)
  11.  
  12.  
  13. def printLong(self, string, row):
  14.     config.lcd_clear()
  15.     my_long_string = string
  16.     my_long_string = my_long_string + " "
  17.     config.lcd_display_string(my_long_string[:19], row)
  18.  
  19.     for i in range(0, len(my_long_string)):
  20.         lcd_text = my_long_string[i:(i + 20)]
  21.         config.lcd_display_string(lcd_text, row)
  22.         time.sleep(0.3)
  23.         # self.display.lcd_clear()
  24.  
  25.  
  26. def printTime():
  27.     config.lcd_clear()
  28.     config.lcd_display_string("ZEGAR:", 1)
  29.     while True:
  30.         data = datetime.now().strftime('%d.%m.%y %H:%M')
  31.         config.lcd_display_string(data, 2)
  32.         time.sleep(1)
  33.  
  34.  
  35. def printTemp(number, frequency):
  36.     config.lcd_clear()
  37.     config.lcd_display_string("TEMP:", 1)
  38.     while True:
  39.         x = round(temp.read_temp(), number)
  40.         temperature = "{temp:." + str(number) + "f}"
  41.         string = str(temperature.format(temp=x))
  42.         config.lcd_display_string(string + " C", 2)
  43.         time.sleep(frequency)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement