Example #1
0
#Google Analytics to PiGlow LEDS
from piglow import PiGlow
import time
import urllib2

piglow = PiGlow()
#Test
i = 0
while (i < 2):
    piglow.arm1(127)
    time.sleep(0.1)
    piglow.arm1(0)
    piglow.arm2(127)
    time.sleep(0.1)
    piglow.arm2(000)
    piglow.arm3(127)
    time.sleep(0.1)
    piglow.arm3(0)
    #Test Completed
    i = i + 1

while True:
    response = urllib2.urlopen('http://ryanteck.org.uk/nginx_status')
    html = response.read()
    data = html.split('\n')
    active = data[0].split(":")
    count = active[1]
    count = int(count) - 1
    #print(count)

    if (count == 0):
Example #2
0
#Google Analytics to PiGlow LEDS
from piglow import PiGlow
import time
import urllib2
piglow = PiGlow()
#Test
i = 0
while (i < 2):
	piglow.arm1(127)
	time.sleep(0.1)
	piglow.arm1(0)
	piglow.arm2(127)
	time.sleep(0.1)
	piglow.arm2(000)
	piglow.arm3(127)
	time.sleep(0.1)
	piglow.arm3(0)
	#Test Completed
	i = i+1

while True:
	response = urllib2.urlopen('http://ryanteck.org.uk/nginx_status')
	html = response.read()
	data = html.split('\n')
	active = data[0].split(":")
	count = active[1]
	count = int(count) -1;
	#print(count)
	
	if(count ==0):
		piglow.all(0)
Example #3
0
 sleep(0.1)
 
 piglow.arm3(2)
 sleep(0.1)
 
 piglow.arm3(3)
 piglow.arm2(1)
 sleep(0.1)
 
 piglow.arm3(2)
 piglow.arm2(2)
 sleep(0.1)
 
 piglow.arm3(1)
 piglow.arm2(3)
 piglow.arm1(1)
 sleep(0.1)
 
 piglow.arm3(0)
 piglow.arm2(2)
 piglow.arm1(2)
 sleep(0.1)
 
 piglow.arm2(1)
 piglow.arm1(3)
 piglow.arm3(1)
 sleep(0.1)
 
 piglow.arm2(0)
 piglow.arm1(2)
 piglow.arm3(2)
Example #4
0
from config import email, password, mail
from piglow import PiGlow

## Init the current device
piglow = PiGlow()

## Device parameters
piglow.all(0)

if mail == 0:
        print "no mail"
        piglow.all(0)
        sleep(0.5)
elif mail < 5:
        print "mail count low"
        piglow.arm1(10)
        sleep(0.5)
elif mail < 10:
        print "mail count medium"
        piglow.arm1(10)
        piglow.arm2(10)
        sleep(0.5)
elif mail < 15:
        print "mail count high"
        piglow.arm1(10)
        piglow.arm2(10)
        piglow.arm3(10)
        sleep(0.5)
else:
        print "too many emails"
        for x in range(0, 10):
Example #5
0
from config import email, password, mail
from piglow import PiGlow

## Init the current device
piglow = PiGlow()

## Device parameters
piglow.all(0)

if mail == 0:
    print "no mail"
    piglow.all(0)
    sleep(0.5)
elif mail < 5:
    print "mail count low"
    piglow.arm1(10)
    sleep(0.5)
elif mail < 10:
    print "mail count medium"
    piglow.arm1(10)
    piglow.arm2(10)
    sleep(0.5)
elif mail < 15:
    print "mail count high"
    piglow.arm1(10)
    piglow.arm2(10)
    piglow.arm3(10)
    sleep(0.5)
else:
    print "too many emails"
    for x in range(0, 10):
Example #6
0
	
	#Red off
	piglow.red(204)
	sleep(0.1)
	piglow.red(153)
	sleep(0.1)
	piglow.red(102)
	sleep(0.1)
	piglow.red(51)
	sleep(0.1)
	piglow.red(0)
	sleep(0.1)
	
	###Arm fade on
	#Arm1 fade on
	piglow.arm1(51)
	sleep(0.1)
	piglow.arm1(102)
	sleep(0.1)
	piglow.arm1(153)
	sleep(0.1)
	piglow.arm1(204)
	sleep(0.1)
	piglow.arm1(255)
	sleep(0.1)
	
	#Arm2 fade on
	piglow.arm2(51)
	sleep(0.1)
	piglow.arm2(102)
	sleep(0.1)
Example #7
0
class Luces:
    def __init__(self):
        self.piglow = PiGlow()

    def get_intensity(self, value):
        pass

    def encenderblanco(self, value=100):
        self.piglow.white(value)

    def apagarblanco(self):
        self.piglow.white(0)

    def parpadearblanco(self, tiempo=1, value=100):
        self.encenderblanco(value)
        time.sleep(tiempo)
        self.apagarblanco()

    def encenderazul(self, value=100):
        self.piglow.blue(value)

    def apagarazul(self):
        self.piglow.blue(0)

    def parpadearazul(self, tiempo=1, value=100):
        self.encenderazul(value)
        time.sleep(tiempo)
        self.apagarazul()

    def encenderverde(self, value=100):
        self.piglow.green(value)

    def apagarverde(self):
        self.piglow.green(0)

    def parpadearverde(self, tiempo=1, value=100):
        self.encenderverde(value)
        time.sleep(tiempo)
        self.apagarverde()

    def encenderamarillo(self, value=100):
        self.piglow.yellow(value)

    def apagaramarillo(self):
        self.piglow.yellow(0)

    def parpadearamarillo(self, tiempo=1, value=100):
        self.encenderamarillo(value)
        time.sleep(tiempo)
        self.apagaramarillo()

    def encendernaranja(self, value=100):
        self.piglow.orange(value)

    def apagarnaranja(self):
        self.piglow.orange(0)

    def parpadearnaranja(self, tiempo=1, value=100):
        self.encendernaranja(value)
        time.sleep(tiempo)
        self.apagarnarnanja()

    def encenderrojo(self, value=100):
        self.piglow.red(value)

    def apagarrojo(self):
        self.piglow.red(0)

    def parpadearrojo(self, tiempo=1, value=100):
        self.encenderrojo(value)
        time.sleep(tiempo)
        self.apagarrojo()

    def encendertodas(self, value=100):
        self.piglow.all(value)

    def apagartodas(self):
        self.piglow.all(0)

    def parpadeartodas(self, tiempo=1, value=100):
        self.encendertodas(value)
        time.sleep(tiempo)
        self.apagartodas()

    def encenderbrazo(self, arm, value=100):
        self.piglow.arm(arm, value)

    def apagarbrazo(self, arm):
        self.piglow.arm(arm, 0)

    def parpadearbrazo(self, arm, tiempo=1, value=100):
        self.encenderbrazo(arm, value)
        time.sleep(tiempo)
        self.apagarbrazo(arm)

    def encenderbrazo1(self, value=100):
        self.piglow.arm1(value)

    def apagarbrazo1(self):
        self.piglow.arm1(0)

    def parpadearbrazo1(self, tiempo=1, value=100):
        self.encenderbrazo1(value)
        time.sleep(tiempo)
        self.apagarbrazo1()

    def encenderbrazo2(self, value=100):
        self.piglow.arm2(value)

    def apagarbrazo2(self):
        self.piglow.arm2(0)

    def parpadearbrazo2(self, tiempo=1, value=100):
        self.encenderbrazo2(value)
        time.sleep(tiempo)
        self.apagarbrazo2()

    def encenderbrazo3(self, value=100):
        self.piglow.arm3(value)

    def apagarbrazo3(self):
        self.piglow.arm3(0)

    def parpadearbrazo3(self, tiempo=1, value=100):
        self.encenderbrazo3(value)
        time.sleep(tiempo)
        self.apagarbrazo3()

    def encendercolor(self, colour, value=10):
        if colour == 1 or colour == "blanco":
            self.piglow.colour("white", value)
        elif colour == 2 or colour == "azul":
            self.piglow.colour("blue", value)
        elif colour == 3 or colour == "verde":
            self.piglow.colour("green", value)
        elif colour == 4 or colour == "amarillo":
            self.piglow.colour("yellow", value)
        elif colour == 5 or colour == "naranja":
            self.piglow.colour("orange", value)
        elif colour == 6 or colour == "rojo":
            self.piglow.colour("red", value)
        else:
            print "Solo los colores de 1 - 6 o los nombres de colores estan permitidos"

    def apagarcolor(self, colour):
        value = 0

        if colour == 1 or colour == "blanco":
            self.piglow.colour("white", value)
        elif colour == 2 or colour == "azul":
            self.piglow.colour("blue", value)
        elif colour == 3 or colour == "verde":
            self.piglow.colour("green", value)
        elif colour == 4 or colour == "amarillo":
            self.piglow.colour("yellow", value)
        elif colour == 5 or colour == "naranja":
            self.piglow.colour("orange", value)
        elif colour == 6 or colour == "rojo":
            self.piglow.colour("red", value)
        else:
            print "Solo los colores de 1 - 6 o los nombres de colores estan permitidos"

    def parpadearcolor(self, colour, tiempo=1, value=100):
        self.encendercolor(colour, value)
        time.sleep(tiempo)
        self.apagarcolor(colour)

    def encenderluz(self, led, value=100):
        self.piglow.led(led, value)

    def apagarluz(self, led):
        self.piglow.led(led, 0)

    def parpadearluz(self, led, tiempo=1, value=100):
        self.encenderluz(led, value)
        time.sleep(tiempo)
        self.apagarluz(led)