Skip to content

Instantly share code, notes, and snippets.

@bjoernhohe
Created May 12, 2019 08:41
Show Gist options
  • Save bjoernhohe/70c156e2052d4119ccfc9feef0b11e02 to your computer and use it in GitHub Desktop.
Save bjoernhohe/70c156e2052d4119ccfc9feef0b11e02 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import LCD1602
import time
from datetime import datetime
def setup():
LCD1602.init(0x27, 1) # init(slave address, background light)
i = datetime.now()
start = datetime(2015, 3, 25)
delta = i - start
weeks = (delta.days)/7
#x = int(weeks)
LCD1602.write(0, 0, "weeks")
#LCD1602.write(1, 1, 'from SunFounder')
time.sleep(2)
def loop():
LCD1602.init(0x27, 1) # init(slave address, background light)
space = ' '
greetings = 'Thank you for buying SunFounder Sensor Kit for Raspberry! ^_^'
greetings = space + greetings
while True:
tmp = greetings
for i in range(0, len(greetings)):
LCD1602.write(0, 0, tmp)
tmp = tmp[1:]
time.sleep(0.8)
LCD1602.clear()
def destroy():
pass
if __name__ == "__main__":
try:
setup()
while True:
pass
except KeyboardInterrupt:
destroy()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment