Skip to content

Instantly share code, notes, and snippets.

@phodal
Created May 10, 2014 06:42
Show Gist options
  • Save phodal/dec41f2f139ea7afe891 to your computer and use it in GitHub Desktop.
Save phodal/dec41f2f139ea7afe891 to your computer and use it in GitHub Desktop.
import pcd8544.lcd as lcd
import time, os, sys
import subprocess
if not os.geteuid() == 0:
sys.exit('Script must be run as root')
ON, OFF = [1, 0]
arg='ip route list'
p=subprocess.Popen(arg,shell=True,stdout=subprocess.PIPE)
data = p.communicate()
split_data = data[0].split()
ipaddr = split_data[split_data.index('src')+1]
while(True):
lcd.init()
lcd.cls()
lcd.backlight(ON)
lcd.define_custom_char([0x30,0x2c,0x66,0x6c,0x30])
lcd.text(ipaddr)
time.sleep(100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment