From 95476aba39bb22c0d477b0df6280847d221035d4 Mon Sep 17 00:00:00 2001 From: 112madgamer Date: Wed, 27 Jan 2016 13:29:08 +1100 Subject: [PATCH] Change command and added wlan0 --- Adafruit_CharLCD/Adafruit_CharLCD_IPclock_example.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Adafruit_CharLCD/Adafruit_CharLCD_IPclock_example.py b/Adafruit_CharLCD/Adafruit_CharLCD_IPclock_example.py index f1be14cd..9dcdb111 100755 --- a/Adafruit_CharLCD/Adafruit_CharLCD_IPclock_example.py +++ b/Adafruit_CharLCD/Adafruit_CharLCD_IPclock_example.py @@ -7,19 +7,20 @@ lcd = Adafruit_CharLCD() -cmd = "ip addr show eth0 | grep inet | awk '{print $2}' | cut -d/ -f1" +en0 = "ip addr show eth0 | grep inet | awk '{print $2}' | cut -d/ -f1" +waln0 = "ifconfig wlan0 | grep 'inet addr:' | cut -d: -f2 | awk '{print $1}'" lcd.begin(16, 1) -def run_cmd(cmd): - p = Popen(cmd, shell=True, stdout=PIPE) +def run_cmd(en0): + p = Popen(en0, shell=True, stdout=PIPE) output = p.communicate()[0] return output while 1: lcd.clear() - ipaddr = run_cmd(cmd) + ipaddr = run_cmd(en0) lcd.message(datetime.now().strftime('%b %d %H:%M:%S\n')) lcd.message('IP %s' % (ipaddr)) sleep(2)