diff --git a/Adafruit_CharLCDPlate/Adafruit_CharLCDPlate.py b/Adafruit_CharLCDPlate/Adafruit_CharLCDPlate.py index 06b9300c..75315b54 100644 --- a/Adafruit_CharLCDPlate/Adafruit_CharLCDPlate.py +++ b/Adafruit_CharLCDPlate/Adafruit_CharLCDPlate.py @@ -439,7 +439,7 @@ def buttons(self): if __name__ == '__main__': - lcd = Adafruit_CharLCDPlate() + lcd = Adafruit_CharLCDPlate(busnum = 1) lcd.begin(16, 2) lcd.clear() lcd.message("Adafruit RGB LCD\nPlate w/Keypad!") diff --git a/Adafruit_CharLCDPlate/Adafruit_CharLCDPlate_IPclock_example.py b/Adafruit_CharLCDPlate/Adafruit_CharLCDPlate_IPclock_example.py new file mode 100755 index 00000000..94d52b1d --- /dev/null +++ b/Adafruit_CharLCDPlate/Adafruit_CharLCDPlate_IPclock_example.py @@ -0,0 +1,25 @@ +#!/usr/bin/python + +from Adafruit_CharLCDPlate import Adafruit_CharLCDPlate +from subprocess import * +from time import sleep, strftime +from datetime import datetime + +lcd = Adafruit_CharLCDPlate() + +# Quotes so it pick up only ipv4 address +cmd = "ip addr show eth0 | grep 'inet ' | awk '{print $2}' | cut -d/ -f1" + +lcd.begin(16,1) + +def run_cmd(cmd): + p = Popen(cmd, shell=True, stdout=PIPE) + output = p.communicate()[0] + return output + +while 1: + lcd.clear() + ipaddr = run_cmd(cmd) + lcd.message(datetime.now().strftime('%b %d %H:%M:%S\n')) + lcd.message('IP %s' % ( ipaddr ) ) + sleep(2) diff --git a/README.md b/README.md index aba2ae53..cae9a4a0 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ +Added +============ +Clock + IP example for Adafruit_CharLCDPlate + +Ed Watson (tactmaster) + Adafruit's Raspberry-Pi Python Code Library ============ Here is a growing collection of libraries and example python scripts