lcd_ip.py 471 B

123456789101112131415161718192021
  1. #!/usr/bin/python3
  2. from signal import signal, SIGTERM, SIGHUP, pause
  3. from rpi_lcd import LCD
  4. import subprocess
  5. import time
  6. lcd = LCD(address=0x3f,bus=0)
  7. while True:
  8. p = subprocess.run("ip -s link show dev wlan0 | tail -n 4",shell=True,stdout=subprocess.PIPE,universal_newlines=True)
  9. r = p.stdout.splitlines()
  10. r = [a.strip() for a in r]
  11. lcd.text(r[0][:20],1)
  12. lcd.text(r[1][:20],2)
  13. lcd.text(r[2][:20],3)
  14. lcd.text(r[3][:20],4)
  15. time.sleep(3)
  16. lcd.clear()