Пример #1
0
 def blink(self):
     print "getting lock"
     if self.lock.acquire(0):
         print "starting blink"
         for i in range(1,5):
             lamplib.setcolor("00",255,0,0)
             time.sleep(0.1)
             lamplib.setcolor("00",0,0,0)
             time.sleep(0.5)
         lamplib.setcolor("00",0,255,255)
         self.lock.release()
     print "returning from thread"
Пример #2
0
 def blink(self):
     print "getting lock"
     if self.lock.acquire(0):
         print "starting blink"
         for i in range(1, 5):
             lamplib.setcolor("00", 255, 0, 0)
             time.sleep(0.1)
             lamplib.setcolor("00", 0, 0, 0)
             time.sleep(0.5)
         lamplib.setcolor("00", 0, 255, 255)
         self.lock.release()
     print "returning from thread"
Пример #3
0
import lamplib
import time

speed = 50.0


def fadeOn(lamp):
    lamplib.fade(lamp, 255, 255, 0, 200 * speed)


def fadeOff(lamp):
    lamplib.fade(lamp, 0, 0, 255, 200 * speed)


lamps = ("31", "30", "51", "33", "10", "32")
# ,'12','21','1B','2A','14','1A')
lamp = 0
lamplib.setcolor("FE", 0, 0, 255)
while 1:
    fadeOff(lamps[lamp])
    lamp += 1
    if lamp == len(lamps):
        lamp = 0
    lamplib.fade(lamps[lamp], 0, 0, 127, 400 * speed)
    time.sleep(0.25 / speed)
    lamplib.fade(lamps[lamp], 255, 0, 0, 400 * speed)
    time.sleep(0.25 / speed)

    #    fadeOn(lamps[lamp])
    time.sleep(2 / speed)
Пример #4
0
def new_color(color):
    c = color.get_current_color()
    r = c.red / 256
    g = c.green / 256
    b = c.blue / 256
    lamplib.setcolor(lamp, r, g, b)
Пример #5
0
import time
import sys
import lamplib

if len(sys.argv) > 2:
    lamp = sys.argv[2]
else:
    lamp = "00"

w = float(sys.argv[1])

while(1):
    lamplib.setcolor(lamp, 0, 0, 255)
    time.sleep(w)
    
    lamplib.setcolor(lamp, 0, 0, 0)
    time.sleep(w)
Пример #6
0
import lamplib
import time

speed = 50.


def fadeOn(lamp):
    lamplib.fade(lamp, 255, 255, 0, 200 * speed)


def fadeOff(lamp):
    lamplib.fade(lamp, 0, 0, 255, 200 * speed)


lamps = ('31', '30', '51', '33', '10', '32')
#,'12','21','1B','2A','14','1A')
lamp = 0
lamplib.setcolor('FE', 0, 0, 255)
while 1:
    fadeOff(lamps[lamp])
    lamp += 1
    if lamp == len(lamps):
        lamp = 0
    lamplib.fade(lamps[lamp], 0, 0, 127, 400 * speed)
    time.sleep(0.25 / speed)
    lamplib.fade(lamps[lamp], 255, 0, 0, 400 * speed)
    time.sleep(0.25 / speed)

    #    fadeOn(lamps[lamp])
    time.sleep(2 / speed)
Пример #7
0
def new_color(color):
    c = color.get_current_color()
    r = c.red / 256
    g = c.green / 256
    b = c.blue / 256
    lamplib.setcolor(lamp, r, g, b)
Пример #8
0
import lamplib
import time

while 1:
    lamplib.setcolor("00", 0, 0, 255)
    time.sleep(0.5)
    lamplib.setcolor("00", 0, 0, 0)
    time.sleep(0.5)
Пример #9
0
import time
import sys
import lamplib

if len(sys.argv) > 2:
    lamp = sys.argv[2]
else:
    lamp = "00"

w = float(sys.argv[1])

while (1):
    lamplib.setcolor(lamp, 0, 0, 255)
    time.sleep(w)

    lamplib.setcolor(lamp, 0, 0, 0)
    time.sleep(w)