示例#1
0
def all_leds_off():
    world = LEDWorldBuilder().add_octa_circle().build()
    color = (0, 0, 0)
    led_all = LEDAll(color)
    pixels = world.draw([led_all], None)
    client.put_pixels(pixels)
    client.put_pixels(pixels)
示例#2
0
def all_leds_off():
    world = LEDWorldBuilder().add_octa_circle().build()
    color = (0, 0, 0)
    led_all = LEDAll(color)
    pixels = world.draw([led_all], None)
    client.put_pixels(pixels)
    client.put_pixels(pixels)
示例#3
0
def working_light():
    world = LEDWorldBuilder().add_octa_circle().build()
    color = (237, 183, 21)
    location = ObjectLocation(-45, 90)
    led_spot = LEDSpot(color, location, 120)

    pixels = world.draw([led_spot], datetime.now())
    client.put_pixels(pixels)
    client.put_pixels(pixels)
示例#4
0
def working_light():
    world = LEDWorldBuilder().add_octa_circle().build()
    color = (237, 183, 21)
    location = ObjectLocation(-45, 90)
    led_spot = LEDSpot(color, location, 120)

    pixels = world.draw([led_spot], datetime.now())
    client.put_pixels(pixels)
    client.put_pixels(pixels)
示例#5
0
def show_wave():
    world = LEDWorldBuilder().add_octa_circle().build()
    color = (150, 0, 0)
    led_wave = LEDWave(color, 1, 15)

    while True:
        now = datetime.now()
        pixels = world.draw([led_wave], now)
        client.put_pixels(pixels)
        time.sleep(0.02)
示例#6
0
def show_pulsing():
    world = LEDWorldBuilder().add_octa_circle().build()
    color = (255, 0, 0)
    led_puls = LEDAllPulsing(color, 0.1)

    while True:
        now = datetime.now()
        pixels = world.draw([led_puls], now)
        client.put_pixels(pixels)
        time.sleep(0.02)
示例#7
0
def show_pulsing():
    world = LEDWorldBuilder().add_octa_circle().build()
    color = (255, 0, 0)
    led_puls = LEDAllPulsing(color, 0.1)

    while True:
        now = datetime.now()
        pixels = world.draw([led_puls], now)
        client.put_pixels(pixels)
        time.sleep(0.02)
示例#8
0
def show_wave():
    world = LEDWorldBuilder().add_octa_circle().build()
    color = (150, 0, 0)
    led_wave = LEDWave(color, 1, 15)

    while True:
        now = datetime.now()
        pixels = world.draw([led_wave], now)
        client.put_pixels(pixels)
        time.sleep(0.02)
示例#9
0
def show_drop():
    world = LEDWorldBuilder().add_octa_circle().build()
    location = ObjectLocation(0, 0.5)
    color = (52, 141, 151)
    led_drop = LEDContinuousDrop(color, location, 0.75, decrease=0.05, end_after=1)
    symbols = [led_drop]
    while symbols:
        now = datetime.now()
        pixels = world.draw(symbols, now)
        client.put_pixels(pixels)
        symbols = [s for s in symbols if not s.dead]
        time.sleep(0.02)
示例#10
0
def show_animated_spot():
    world = LEDWorldBuilder().add_octa_circle().build()
    color = (237, 183, 21)
    location = ObjectLocation(0, 1.5)
    led_spot = LEDSpot(color, location, 1.0/60 * 30, 0.25, 0.3)

    symbols = [led_spot]
    while symbols:
        now = datetime.now()
        pixels = world.draw(symbols, now)
        client.put_pixels(pixels)
        symbols = [s for s in symbols if not s.dead]
        time.sleep(0.02)
示例#11
0
def show_animated_spot():
    world = LEDWorldBuilder().add_octa_circle().build()
    color = (237, 183, 21)
    location = ObjectLocation(0, 1.5)
    led_spot = LEDSpot(color, location, 1.0 / 60 * 30, 0.25, 0.3)

    symbols = [led_spot]
    while symbols:
        now = datetime.now()
        pixels = world.draw(symbols, now)
        client.put_pixels(pixels)
        symbols = [s for s in symbols if not s.dead]
        time.sleep(0.02)
示例#12
0
def show_continuous_drop():
    world = LEDWorldBuilder().add_octa_circle().build()
    location = ObjectLocation(0, 0.5)
    color = (255, 255, 255)  #(52, 141, 151)
    led_drop = LEDContinuousDrop(color, location, 1.0)
    symbols = [led_drop]
    while symbols:
        now = datetime.now()
        pixels = world.draw(symbols, now)
        client.put_pixels(pixels)
        client.put_pixels(pixels)
        symbols = [s for s in symbols if not s.dead]
        time.sleep(0.02)
示例#13
0
class TestingMode(threading.Thread):
    def __init__(self, client):
        super(TestingMode, self).__init__()
        self.world = LEDWorldBuilder().add_octa_circle().build()
        self.client = client
        self.stopped = False
        self.symbols = []

    def run(self):
        while not self.stopped:
            now = datetime.now()
            pixels = self.world.draw(self.symbols, now)
            self.client.put_pixels(pixels)
            self.symbols[:] = [s for s in self.symbols if not s.dead]
            time.sleep(0.02)

    def stop(self):
        self.stopped = True
        self.off()

    def create(self):
        pass

    def move(self, angle):
        pass

    def off(self):
        self.client.put_pixels([(0, 0, 0,)] * self.world.led_count)
示例#14
0
def show_spot_round():
    world = LEDWorldBuilder().add_octa_circle().build()
    color = (255, 255, 255)
    location = ObjectLocation(0, 1.414213562)
    led_spot = LEDSpot(color, location, 1.0 / 60 * 20)

    pixels = world.draw([led_spot], datetime.now())
    client.put_pixels(pixels)
    client.put_pixels(pixels)

    angle_inc = 1
    while True:
        led_spot.location.angle += angle_inc
        if led_spot.location.angle > 360:
            led_spot.location.angle
        pixels = world.draw([led_spot], datetime.now())
        client.put_pixels(pixels)
        time.sleep(0.01)
示例#15
0
def show_spot():
    world = LEDWorldBuilder().add_octa_circle().build()
    color = (255, 0, 0)
    location = ObjectLocation(0, 1.414213562)
    led_spot = LEDSpot(color, location, 1.0/60 * 20)

    pixels = world.draw([led_spot], 0)
    client.put_pixels(pixels)
    client.put_pixels(pixels)

    angle_inc = 1
    while True:
        led_spot.location.angle += angle_inc
        if led_spot.location.angle > 45 or led_spot.location.angle < (-45-45):
            angle_inc *= -1
        pixels = world.draw([led_spot], 0)
        client.put_pixels(pixels)
        time.sleep(0.02)
示例#16
0
def show_spot_round():
    world = LEDWorldBuilder().add_octa_circle().build()
    color = (255, 255, 255)
    location = ObjectLocation(0, 1.414213562)
    led_spot = LEDSpot(color, location, 1.0/60 * 20)

    pixels = world.draw([led_spot], datetime.now())
    client.put_pixels(pixels)
    client.put_pixels(pixels)

    angle_inc = 1
    while True:
        led_spot.location.angle += angle_inc
        if led_spot.location.angle > 360:
            led_spot.location.angle
        pixels = world.draw([led_spot], datetime.now())
        client.put_pixels(pixels)
        time.sleep(0.01)
示例#17
0
def get_led_controller():
    global led_controller
    if led_controller is None:
        world = LEDWorldBuilder().add_octa_circle().build()
        client = opc.Client(FC_SERVER)
        led_controller = LEDController(world, client)
        led_controller.start()
        led_controller.off()
    return led_controller
示例#18
0
def show_spot():
    world = LEDWorldBuilder().add_octa_circle().build()
    color = (255, 0, 0)
    location = ObjectLocation(0, 1.414213562)
    led_spot = LEDSpot(color, location, 1.0 / 60 * 20)

    pixels = world.draw([led_spot], 0)
    client.put_pixels(pixels)
    client.put_pixels(pixels)

    angle_inc = 1
    while True:
        led_spot.location.angle += angle_inc
        if led_spot.location.angle > 45 or led_spot.location.angle < (-45 -
                                                                      45):
            angle_inc *= -1
        pixels = world.draw([led_spot], 0)
        client.put_pixels(pixels)
        time.sleep(0.02)
示例#19
0
 def __init__(self, client):
     super(TestingMode, self).__init__()
     self.world = LEDWorldBuilder().add_octa_circle().build()
     self.client = client
     self.stopped = False
     self.symbols = []