cd ~
git clone [email protected]:/ad7dd2f30fbff5747522.git boot
sudo chmod 755 /home/tom32i/boot/launcher
Edit the crontab config:
sudo vim /etc/rc.local
Add the following line:
/home/tom32i/boot/launcher
cd ~
git clone [email protected]:/ad7dd2f30fbff5747522.git boot
sudo chmod 755 /home/tom32i/boot/launcher
Edit the crontab config:
sudo vim /etc/rc.local
Add the following line:
/home/tom32i/boot/launcher
| #!/usr/bin/env python | |
| import signal | |
| import dot3k.joystick as joystick | |
| import screen | |
| import scanner | |
| color_ok = [0, 200, 180] | |
| color_ko = [180, 0, 50] | |
| @joystick.on(joystick.RIGHT) | |
| def show_ip(pin): | |
| ip = scanner.get_ip_address('eth0') | |
| if ip: | |
| screen.display(["My ip:", " " + ip], color_ok) | |
| else: | |
| screen.display(["", "No ethernet :(", ip], color_ko) | |
| @joystick.on(joystick.LEFT) | |
| def hide_ip(pin): | |
| screen.clear() | |
| signal.pause() |
| #!/bin/bash | |
| sudo python /home/tom32i/boot/welcome.py & | |
| sudo python /home/tom32i/boot/ip.py & |
| #!/usr/bin/env python | |
| import socket | |
| import fcntl | |
| import struct | |
| def get_ip_address(ifname): | |
| try: | |
| s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
| return socket.inet_ntoa(fcntl.ioctl( | |
| s.fileno(), | |
| 0x8915, # SIOCGIFADDR | |
| struct.pack('256s', ifname[:15]) | |
| )[20:24]) | |
| except IOError: | |
| return False |
| #!/usr/bin/env python | |
| import dot3k.lcd as lcd | |
| import dot3k.backlight as backlight | |
| def display(messages, color = False): | |
| if not type(messages) is list: | |
| messages = [messages] | |
| if len(messages) > 3: | |
| raise Exception("Only 3 rows on the Display-o-ton 3000!") | |
| lcd.clear() | |
| if color: | |
| set_color(color) | |
| for (row, message) in enumerate(messages): | |
| lcd.set_cursor_position(0, row) | |
| lcd.write(message) | |
| def set_color(color): | |
| # Green & Blue seems to be mixed up :/ | |
| backlight.rgb(color[0], color[2], color[1]) | |
| def clear(): | |
| lcd.clear() | |
| backlight.rgb(0,0,0) |
| #!/usr/bin/env python | |
| import time | |
| import screen | |
| screen.display([" ___ _ _", " | _ _ _) ) o", " |(_)|||_)/_ |"], [0, 255, 156]) | |
| time.sleep(2) | |
| screen.clear() |