|Camera box setup for PAN001|
showing the arduino + hub +
DHT22 setup. Also a tangle of wires.
Quick solution consists of two components: one is a bash script that gets the IP address, the other is a python script that displays the IP address on the 8x8 led matrix provided by the SenseHat.
Code samples are listed below. Sorry about the lack of syntax highlighting and formatting. Blogger doesn't make that super easy for me and I don't have time to figure it out.
Video in action!
Added to $HOME/.profile:
#!/bin/bash IP=`ifconfig eth0 | grep 'inet ' | cut -d ' ' -f 10` /home/pi/show-ip.py $IP
#!/usr/bin/env python3 import os import sys from sense_hat import SenseHat show_ip = True fn = '/home/pi/show-ip'
# Don't want to run program twice if os.path.exists(fn) is True: sys.exit() else: with open(fn, 'w') as f: f.write('') try: ip = sys.argv except IndexError: print("Must pass an IP") else: sense = SenseHat() while show_ip: event = sense.stick.get_events() if len(event) > 0: break else: sense.show_message(ip) sense.clear() os.unlink(fn)