Created
February 26, 2016 15:51
-
-
Save sourceperl/778a5f3cba2a3a05a7ec to your computer and use it in GitHub Desktop.
Clock on a Rpi with a 4x20 LCD on I2C port
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import time | |
import schedule | |
import RPi_I2C_LCD | |
# global var | |
lcd = RPi_I2C_LCD.LCD() | |
def update_lcd(): | |
# l2 | |
lcd.set_cursor(row=1) | |
lcd.message(time.strftime('%d/%m/%Y %H:%M:%S', time.localtime())) | |
if __name__ == '__main__': | |
# init LCD screen | |
lcd.set_backlight(True) | |
lcd.home() | |
schedule.every(1).second.do(update_lcd) | |
# main loop | |
while True: | |
schedule.run_pending() | |
time.sleep(.5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment