SHARE
TWEET

Untitled

a guest May 22nd, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2. import LCD1602
  3. import time
  4. from datetime import datetime
  5.  
  6. def setup():
  7.     LCD1602.init(0x27, 1)   # init(slave address, background light)
  8.     i = datetime.now()
  9.     start = datetime(2015, 3, 25)
  10.     delta = i - start
  11.     weeks = (delta.days)/7
  12.     #x = int(weeks)  
  13.     LCD1602.write(0, 0, "weeks")
  14.     #LCD1602.write(1, 1, 'from SunFounder')
  15.     time.sleep(2)
  16.  
  17. def loop():
  18.     LCD1602.init(0x27, 1)   # init(slave address, background light)
  19.     space = '                '
  20.     greetings = 'Thank you for buying SunFounder Sensor Kit for Raspberry! ^_^'
  21.     greetings = space + greetings
  22.     while True:
  23.         tmp = greetings
  24.         for i in range(0, len(greetings)):
  25.             LCD1602.write(0, 0, tmp)
  26.             tmp = tmp[1:]
  27.             time.sleep(0.8)
  28.             LCD1602.clear()
  29.  
  30. def destroy():
  31.     pass    
  32.  
  33. if __name__ == "__main__":
  34.     try:
  35.         setup()
  36.         while True:
  37.             pass
  38.     except KeyboardInterrupt:
  39.         destroy()
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top