Last active
September 3, 2016 00:50
-
-
Save anuragpeshne/b3706f736286a7f38f99776b125d3330 to your computer and use it in GitHub Desktop.
This file contains 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 python | |
from RPLCD import CharLCD, cleared, cursor | |
import socket | |
import time, datetime | |
lcd = CharLCD() | |
# load IP address | |
import socket | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
s.connect(("gmail.com",80)) | |
ipAddress = s.getsockname()[0] | |
s.close() | |
with cleared(lcd): | |
lcd.write_string(ipAddress) | |
ticker = True | |
while True: | |
if ticker: | |
dateTimeStr = datetime.datetime.now().strftime("%I:%M%p %b %d") | |
ticker = False | |
else: | |
dateTimeStr = datetime.datetime.now().strftime("%I %M%p %b %d") | |
ticker = True | |
with cursor(lcd, 1, 0): | |
lcd.write_string(dateTimeStr) | |
time.sleep(1) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment