示例#1
0
    def __init__(self, update_lamps, num_lamps, lamps):
        # mandatory variables
        self.num_lamps = num_lamps
        self.update_lamps = update_lamps
        self.t_interval = .02  # Interval to be called in seconds
        self.change_time = 9000
        self.time_count = self.change_time
        self.cur_pattern = 0

        # custom initialization
        self.colors = []
        self.current_lamp = self.num_lamps - 1
        self.start_color = YELLOW
        self.wait_time = 1
        self.target_color = COLOR_WHEEL[random.randrange(0, len(COLOR_WHEEL))]
        self.brightness = 100
        self.last_time = time.time()
        self.off_color = Color(15, 15, 0)
        self.running = False
        self.start_count = 1

        #        print("num_lamps = {}".format(num_lamps))
        for i in range(0, self.num_lamps):
            #            print("ia = {}".format(i))
            lamps.colors[i] = self.off_color
示例#2
0
from LEDColors.Colors import RED, BLUE, GREEN, YELLOW, CYAN, MAGENTA, BLACK, Color, ColorArray
import os
import random
import sys
import time

COLOR1 = Color(0, 0, 0)
COLOR2 = Color(0, 0, 0)
COLOR1 = Color(180, 50, 0)
COLOR2 = Color(180, 150, 0)
TWINKLE = Color(180, 0, 0)
#TWINKLE = YELLOW
TURNOVER = 1
TWINKLE_TIME = 6
TWINKLE_TIME = 9


def load_plugin(update_lamps, num_lamps, lamps):
    return Glitter(update_lamps, num_lamps, lamps)


class Glitter(object):
    def __init__(self, update_lamps, num_lamps, lamps):
        # mandatory variables
        self.num_lamps = num_lamps
        self.update_lamps = update_lamps
        self.m_interval = .01  # Interval to be called in milliseconds

        # custom initialization
        self.increments = []
        self.states = []
示例#3
0
from LEDColors.Colors import RED, BLUE, GREEN, YELLOW, CYAN, MAGENTA, BLACK, Color, ColorArray
import os
import random
import sys
import time

COLOR1 = Color(0, 0, 0)
COLOR2 = Color(0, 0, 0)
COLOR1 = Color(180, 80, 0)
COLOR2 = Color(180, 150, 0)
TWINKLE = Color(180, 0, 0)
#TWINKLE = YELLOW
TURNOVER = 1
TWINKLE_TIME = 6
TWINKLE_TIME = 12
COLOR1 = RED
COLOR2 = GREEN
TWINKLE = YELLOW
COLOR_WHEEL = [RED, GREEN, MAGENTA, Color(0, 0, 255), YELLOW]
COLOR_WHEEL = [
    Color(255, 150, 150),
    Color(100, 255, 255),
    Color(150, 255, 150),
    Color(250, 150, 255),
    Color(120, 120, 255),
    Color(255, 255, 80)
]
COLOR_WHEEL = [RED, GREEN, MAGENTA, Color(0, 0, 255), YELLOW]
NUM_COLORS = len(COLOR_WHEEL)

示例#4
0
from LEDColors.Colors import RED, BLUE, GREEN, YELLOW, CYAN, MAGENTA, BLACK, Color, ColorArray
import os
import random
import sys

COLOR_WHEEL = [
    RED, CYAN, GREEN, MAGENTA,
    Color(0, 0, 255), YELLOW,
    Color(200, 150, 0)
]
COLOR_WHEEL = [
    Color(255, 230, 140),
    Color(165, 155, 95),
    Color(100, 90, 60),
    Color(60, 50, 30)
]


def load_plugin(update_lamps, num_lamps, lamps):
    return RandomFade(update_lamps, num_lamps, lamps)


class RandomFade(object):
    def __init__(self, update_lamps, num_lamps, lamps):
        # custom initialization
        self.increments = []
        self.targets = []
        self.num_lamps = num_lamps
        self.update_lamps = update_lamps
        self.m_interval = .0333  # Interval to be called in milliseconds
        self.brightness = 100
示例#5
0
from LEDColors.Colors import RED, BLUE, GREEN, YELLOW, CYAN, MAGENTA, BLACK, Color, ColorArray
import os
import random
import sys
import time

COLOR1 = Color(0, 0, 0)
COLOR2 = Color(0, 0, 0)
COLOR1 = Color(255, 0, 0)
COLOR2 = Color(255, 100, 75)
#COLOR2 = Color(120, 120, 220)
TWINKLE = Color(255, 255, 0)
#TWINKLE = YELLOW
TURNOVER = 1
TWINKLE_TIME = 6
TWINKLE_TIME = 9


def load_plugin(update_lamps, num_lamps, lamps):
    return Valentine(update_lamps, num_lamps, lamps)


class Valentine(object):
    def __init__(self, update_lamps, num_lamps, lamps):
        # mandatory variables
        self.num_lamps = num_lamps
        self.update_lamps = update_lamps
        self.m_interval = .01  # Interval to be called in milliseconds

        # custom initialization
        self.increments = []
示例#6
0
from LEDColors.Colors import RED, BLUE, GREEN, YELLOW, CYAN, MAGENTA, BLACK, Color, ColorArray
import os
import random
import sys
import math
import time

WHITE = Color(150, 150, 150)
COLOR_WHEEL = [BLUE, WHITE, CYAN, MAGENTA]

FORWARD = 0
BACKWARD = 1

def clamp(val, v_min, v_max):
#    print(f"val: {val}, min: {v_min}, max: {v_max}")
    return(max(min(v_max, val), v_min))

def load_plugin(update_lamps, num_lamps, lamps):
    return WinterStream(update_lamps, num_lamps, lamps)

class WinterStream(object):
    def __init__(self, update_lamps, num_lamps, lamps):
        # mandatory variables
        self.num_lamps = num_lamps
        self.update_lamps = update_lamps
        self.m_interval = .2      # Interval to be called in milliseconds
        self.strip_len = 5
        self.direction = BACKWARD
        self.direction = FORWARD
        self.cur_count = self.strip_len
        self.lamp_color = COLOR_WHEEL[random.randrange(0, len(COLOR_WHEEL))]
示例#7
0
from LEDColors.Colors import RED, BLUE, GREEN, YELLOW, CYAN, MAGENTA, BLACK, Color, ColorArray
import os
import random
import sys
import time

#TWINKLE = YELLOW
BLACK = Color(0, 0, 0)
COLOR_WHEEL = [RED, GREEN, MAGENTA, BLUE]
NUM_COLORS = len(COLOR_WHEEL)


def load_plugin(update_lamps, num_lamps, lamps):
    return Drip(update_lamps, num_lamps, lamps)


class Drip(object):
    def __init__(self, update_lamps, num_lamps, lamps):
        # mandatory variables
        self.num_lamps = num_lamps
        self.update_lamps = update_lamps
        self.t_interval = .001  # Interval to be called in seconds
        self.change_time = 9000
        self.time_count = self.change_time
        self.cur_pattern = 0

        # custom initialization
        self.colors = []
        self.current_lamp = self.num_lamps - 1
        self.start_color = YELLOW
        self.target_color = COLOR_WHEEL[random.randrange(0, len(COLOR_WHEEL))]
示例#8
0
from LEDColors.Colors import RED, BLUE, GREEN, YELLOW, CYAN, MAGENTA, BLACK, Color, ColorArray
import os
import random
import sys

COLOR_WHEEL = [RED, CYAN, GREEN, MAGENTA, Color(0, 0, 255), YELLOW, Color(200, 150,0)]

COLOR_WHEEL = [
                Color(255, 230, 140)
              , Color(165, 145, 95)
              , Color(100, 90, 60)
            ]

def load_plugin(update_lamps, num_lamps, lamps):
    return RandomGrey(update_lamps, num_lamps, lamps)

class RandomGrey(object):
    def __init__(self, update_lamps, num_lamps, lamps):
        # custom initialization
        self.increments = []
        self.targets = []
        self.num_lamps = num_lamps
        self.update_lamps = update_lamps
        self.m_interval = .0333      # Interval to be called in milliseconds
        self.brightness = 100
        oc = RED
        for i in range(0, num_lamps):
            nc = COLOR_WHEEL[random.randrange(0, len(COLOR_WHEEL))]
            while nc == oc:
                nc = COLOR_WHEEL[random.randrange(0, len(COLOR_WHEEL))]
            oc = nc
示例#9
0
from LEDColors.Colors import RED, BLUE, GREEN, YELLOW, CYAN, MAGENTA, BLACK, Color, ColorArray
import os
import random
import sys
import time

COLOR1 = Color(0, 0, 0)
COLOR2 = Color(0, 0, 0)
COLOR1 = Color(255, 0, 0)
COLOR2 = Color(0, 255, 0)
TWINKLE = Color(255, 255, 0)
#TWINKLE = YELLOW
TURNOVER = 1
TWINKLE_TIME = 6
TWINKLE_TIME = 9

def load_plugin(update_lamps, num_lamps, lamps):
    return XmasGlitter(update_lamps, num_lamps, lamps)

class XmasGlitter(object):
    def __init__(self, update_lamps, num_lamps, lamps):
        # mandatory variables
        self.num_lamps = num_lamps
        self.update_lamps = update_lamps
        self.m_interval = .01      # Interval to be called in milliseconds

        # custom initialization
        self.increments = []
        self.states = []
        self.colors = []
        self.brightness = 100
示例#10
0
from LEDColors.Colors import RED, BLUE, GREEN, YELLOW, CYAN, MAGENTA, BLACK, Color, ColorArray
import os
import random
import sys
import time

WHITE = Color(255, 210, 210)
COLOR_WHEEL = [
    RED, CYAN, GREEN, MAGENTA,
    Color(0, 0, 255), YELLOW,
    Color(200, 150, 0)
]
COLOR_WHEEL1 = [RED, GREEN, BLUE, YELLOW, WHITE]

#TWINKLE = YELLOW
TURNOVER = 1
TWINKLE_TIME = 6
TWINKLE_TIME = 16


def load_plugin(update_lamps, num_lamps, lamps):
    return RandomGlitter(update_lamps, num_lamps, lamps)


class RandomGlitter(object):
    def __init__(self, update_lamps, num_lamps, lamps):
        # mandatory variables
        self.num_lamps = num_lamps
        self.update_lamps = update_lamps
        self.m_interval = .01  # Interval to be called in milliseconds
示例#11
0
from LEDColors.Colors import RED, BLUE, GREEN, YELLOW, CYAN, MAGENTA, BLACK, Color, ColorArray
import os
import random
import sys
import time

COLOR1 = Color(0, 0, 0)
COLOR2 = Color(0, 0, 0)
COLOR1 = Color(180, 80, 0)
COLOR2 = Color(180, 150, 0)
TWINKLE = Color(180, 0, 0)
#TWINKLE = YELLOW
TURNOVER = 1
TWINKLE_TIME = 6
TWINKLE_TIME = 12
COLOR1 = RED
COLOR2 = GREEN
TWINKLE = YELLOW
COLOR_WHEEL = [RED, GREEN, MAGENTA, Color(0, 0, 255), YELLOW]
NUM_COLORS = len(COLOR_WHEEL)


def load_plugin(update_lamps, num_lamps, lamps):
    return Christmas(update_lamps, num_lamps, lamps)


class Christmas(object):
    def __init__(self, update_lamps, num_lamps, lamps):
        # mandatory variables
        self.num_lamps = num_lamps
        self.update_lamps = update_lamps
示例#12
0
    def change(self, lamps):
#        print("here")
        haveChange = False
        if True:
            self.battle_cnt -= 1
            if self.battle_cnt == 0:
                self.battle_cnt = random.randrange(30, 90)
                dir = random.randrange(1, 100)
                if dir > 50:
                    self.midpoint = clamp(self.midpoint + random.randrange(0, +7), 20, self.num_lamps - 20)
                else:
                    self.midpoint =  clamp(self.midpoint - random.randrange(0, +7), 20, self.num_lamps - 20)
                print(f"battle_cnt = {self.battle_cnt}, midpoint = {self.midpoint}")
            i = self.midpoint
            n = 0
            s_cnt = self.start_cnt
            b_cnt = self.black_cnt
            for n in range(0, self.num_lamps):
                i = n
                j = self.num_lamps - 1 - n
#                print(f"n: {n}, i: {i}, j: {j}")
                if i > self.midpoint:
                    if s_cnt < ON_COUNT:
                        lamps.colors[i] = RED
                    elif b_cnt < OFF_COUNT:
                        lamps.colors[i] = BLACK

                if j < self.midpoint:
                    if s_cnt < ON_COUNT:
                        lamps.colors[j] = BLUE
                    elif b_cnt < OFF_COUNT:
                        lamps.colors[j] = BLACK

                if s_cnt == ON_COUNT and b_cnt == OFF_COUNT:
                    s_cnt = 0
                    b_cnt = 0
                elif s_cnt < ON_COUNT:
                    s_cnt += 1
                elif b_cnt < OFF_COUNT:
                    b_cnt += 1

            if self.start_cnt == ON_COUNT and self.black_cnt == OFF_COUNT:
                self.start_cnt = 0
                self.black_cnt = 0
            elif self.start_cnt < ON_COUNT:
                self.start_cnt += 1
            elif self.black_cnt < OFF_COUNT:
                self.black_cnt += 1

            if self.explosion == 0:
                self.explosion = random.randrange(5, 12)
#                print(f"explosion = {self.explosion}")
            for n in range(0, self.explosion): # range(1, 12):
                i = clamp(self.midpoint - n, 0, self.num_lamps)
                j = clamp(self.midpoint + n, 0, self.num_lamps - 1)
                if n == 1:
                    lamps.colors[i] = Color(255, 255, 255)
                    lamps.colors[j] = Color(255, 255, 255)
                else:
                    t = 3
                    e = int(random.random() * 4*math.cos(math.radians(n))+1)
#                    print(f"exp = {self.explosion}, n = {n}, e = {e}{'*' if e < t else ''}")
                    if e < t:
                        lamps.colors[i] = Color(255, 255, 255)
                        lamps.colors[j] = Color(255, 255, 255)
#            lamps.colors[self.midpoint] = Color(255, 255, 255)
            self.explosion -= 1
#            print("\n")

        self.update_lamps(lamps)
示例#13
0
from LEDColors.Colors import RED, BLUE, GREEN, YELLOW, CYAN, MAGENTA, BLACK, Color, ColorArray
import os
import random
import sys

COLOR_WHEEL = [
    RED, CYAN, GREEN, MAGENTA,
    Color(0, 0, 255), YELLOW,
    Color(200, 150, 0)
]

#COLOR_WHEEL = [
#                Color(255, 150, 150)
#              , Color(100, 255, 255)
#              , Color(150, 255, 150)
#              , Color(250, 150, 255)
#              , Color(120, 120, 255)
#              , Color(255, 255, 80)
#            ]


def load_plugin(update_lamps, num_lamps, lamps):
    return RandomFade(update_lamps, num_lamps, lamps)


class RandomFade(object):
    def __init__(self, update_lamps, num_lamps, lamps):
        # custom initialization
        self.increments = []
        self.targets = []
        self.num_lamps = num_lamps
示例#14
0
from LEDColors.Colors import RED, BLUE, GREEN, YELLOW, CYAN, MAGENTA, BLACK, Color, ColorArray
import os
import random
import sys
import time

COLOR_WHEEL = [RED, CYAN, GREEN, MAGENTA, Color(0, 0, 255), YELLOW]


#COLOR_WHEEL = [
#                Color(255, 150, 150)
#              , Color(100, 255, 255)
#              , Color(150, 255, 150)
#              , Color(250, 150, 255)
#              , Color(120, 120, 255)
#              , Color(255, 255, 80)
#            ]
def load_plugin(update_lamps, num_lamps, lamps):
    return Pattern(update_lamps, num_lamps, lamps)


class Pattern(object):
    def __init__(self, update_lamps, num_lamps, lamps):
        # custom initialization
        self.increments = []
        self.last_color = cur_color = random.randrange(0, len(COLOR_WHEEL))
        i = 0
        for color in COLOR_WHEEL:
            self.increments.append(1)
            i = i + 1
        print("len(COLOR_SHEEL) = {}".format(len(COLOR_WHEEL)))