SHARE
TWEET

Untitled

a guest Aug 12th, 2016 21 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import datetime as dt
  2. import RPi.GPIO as GPIO
  3. import Adafruit_CharLCD as LCD
  4.  
  5. class LCDSchedule:
  6.  
  7.     def __init__(self):
  8.         # initialize timer
  9.  
  10.         # initialize variable for messages to lcd
  11.         self.msg_row_1 = ""
  12.         self.msg_row_2 = ""
  13.  
  14.         # initialize lcd
  15.         lcd_rs  =   9
  16.         lcd_en  =   22
  17.         lcd_d4  =   25
  18.         lcd_d5  =   24
  19.         lcd_d6  =   23
  20.         lcd_d7  =   20
  21.         lcd_bl  =   2
  22.  
  23.         lcd_col =   16
  24.         lcd_row =   2
  25.         self.lcd = LCD.Adafruit_CharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7, lcd_col, lcd_row, lcd_bl)
  26.  
  27.     def setup(self):
  28.         # get time
  29.         cur_time = dt.datetime.now()
  30.         cur_time = cur_time.strftime("%Y/%m/%d %H:%M:%S")
  31.  
  32.         #set initialz message
  33.         self.msg_row_1 = "SYSTEM STARTING:\n"
  34.         self.msg_row_2 = cur_time
  35.  
  36.         self.lcd.clear()
  37.         self.lcd.message(self.msg_row_1)
  38.         self.lcd.message(self.msg_row_2)
  39.  
  40.     def teardown(self):
  41.        
  42.         # clear LCD on program failure
  43.         self.lcd.clear();
  44.  
  45.     def showMessage(self, display_message_top, display_message_btm):
  46.  
  47.         # clear lcd
  48.         self.lcd.clear()
  49.  
  50.         # print message to lcd
  51.         self.lcd.message(display_message_top + display_message_btm)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top