Created
May 10, 2014 06:42
-
-
Save phodal/dec41f2f139ea7afe891 to your computer and use it in GitHub Desktop.
Raspberry Pi Nokia 5110 display IP http://www.phodal.com/blog/raspberry-pi-use-nokia-5110-display-ip/
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
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