Skip to content

Instantly share code, notes, and snippets.

@anuragpeshne
Last active September 3, 2016 00:50
Show Gist options
  • Save anuragpeshne/b3706f736286a7f38f99776b125d3330 to your computer and use it in GitHub Desktop.
Save anuragpeshne/b3706f736286a7f38f99776b125d3330 to your computer and use it in GitHub Desktop.
#!/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