|
@ -2,6 +2,7 @@ |
|
|
|
|
|
|
|
|
import random |
|
|
import random |
|
|
import time |
|
|
import time |
|
|
|
|
|
import os |
|
|
|
|
|
|
|
|
import blinkt |
|
|
import blinkt |
|
|
|
|
|
|
|
@ -11,8 +12,25 @@ from_led = 0 |
|
|
to_led=6 |
|
|
to_led=6 |
|
|
|
|
|
|
|
|
def pixel_on(): |
|
|
def pixel_on(): |
|
|
|
|
|
hostname= get_hostname() |
|
|
|
|
|
|
|
|
|
|
|
print hostname |
|
|
for i in range(from_led,to_led): |
|
|
for i in range(from_led,to_led): |
|
|
blinkt.set_pixel(i,255,0,0) |
|
|
r = 255 |
|
|
|
|
|
b = 255 |
|
|
|
|
|
g = 255 |
|
|
|
|
|
|
|
|
|
|
|
if hostname == 'quimby': |
|
|
|
|
|
r=0 |
|
|
|
|
|
g=0 |
|
|
|
|
|
elif hostname == 'willie': |
|
|
|
|
|
b = 0 |
|
|
|
|
|
g = 0 |
|
|
|
|
|
elif hostname == 'kirk': |
|
|
|
|
|
r = 0 |
|
|
|
|
|
b = 0 |
|
|
|
|
|
|
|
|
|
|
|
blinkt.set_pixel(i,r,g,b) |
|
|
blinkt.show() |
|
|
blinkt.show() |
|
|
|
|
|
|
|
|
def pixel_off(): |
|
|
def pixel_off(): |
|
@ -26,6 +44,10 @@ def blink_once(): |
|
|
pixel_off() |
|
|
pixel_off() |
|
|
time.sleep(waitstate) |
|
|
time.sleep(waitstate) |
|
|
|
|
|
|
|
|
|
|
|
def get_hostname(): |
|
|
|
|
|
return os.uname()[1] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for i in range(3): |
|
|
for i in range(3): |
|
|
blink_once() |
|
|
blink_once() |
|
|
#while True: |
|
|
#while True: |
|
|