forked from andreeuuetoa/litsimaja
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 545ff966c8 |
@@ -1,7 +1,7 @@
|
|||||||
from pyleds.lib.Config import Config
|
from lib.Config import Config
|
||||||
from pyleds.lib.LoopSwitch import LoopSwitch
|
from lib.LoopSwitch import LoopSwitch
|
||||||
from pyleds.lib.Regions import Regions
|
from lib.Regions import Regions
|
||||||
from pyleds.lib.Tempo import Tempo
|
from lib.Tempo import Tempo
|
||||||
|
|
||||||
|
|
||||||
class Litsimaja(object):
|
class Litsimaja(object):
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from pyleds.lib.Litsimaja import Litsimaja
|
from lib.Litsimaja import Litsimaja
|
||||||
from pyleds.lib.LoopSwitch import LoopSwitch
|
from lib.LoopSwitch import LoopSwitch
|
||||||
|
|
||||||
|
|
||||||
class Program:
|
class Program:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from os import scandir
|
from os import scandir
|
||||||
from pyleds.lib.Litsimaja import Litsimaja
|
from lib.Litsimaja import Litsimaja
|
||||||
from pyleds.lib.Program import Program
|
from lib.Program import Program
|
||||||
|
|
||||||
|
|
||||||
def resolve(namespace: str, class_name: str):
|
def resolve(namespace: str, class_name: str):
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import atexit
|
import atexit
|
||||||
from pyleds.lib.Color import Color
|
from lib.Color import Color
|
||||||
|
|
||||||
|
|
||||||
class _LedData(object):
|
class _LedData(object):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from threading import Thread
|
from threading import Thread
|
||||||
from tkinter import Tk, Label
|
from tkinter import Tk, Label
|
||||||
from FakeStrip import FakeStrip
|
from .FakeStrip import FakeStrip
|
||||||
from pyleds.lib.Color import Color_to_list
|
from lib.Color import Color_to_list
|
||||||
from time import sleep
|
from time import sleep
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from PIL import Image, ImageTk
|
from PIL import Image, ImageTk
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from threading import Thread
|
from threading import Thread
|
||||||
from tkinter import Tk, Canvas
|
from tkinter import Tk, Canvas
|
||||||
from pyleds.lib.strip.FakeStrip import FakeStrip
|
from lib.strip.FakeStrip import FakeStrip
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# Ported by Peter
|
# Ported by Peter
|
||||||
# Palun!
|
# Palun!
|
||||||
|
|
||||||
from pyleds.lib.Program import Program
|
from lib.Program import Program
|
||||||
import time
|
import time
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# Mis m6tted tulevad kui kuuled "MegaMix"?
|
# Mis m6tted tulevad kui kuuled "MegaMix"?
|
||||||
# m6tlen et millal jooma saaks hakata
|
# m6tlen et millal jooma saaks hakata
|
||||||
|
|
||||||
from pyleds.lib.Program import Program
|
from lib.Program import Program
|
||||||
import time
|
import time
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
|||||||
38
pyleds/program/promise/ChristmasLights.py
Normal file
38
pyleds/program/promise/ChristmasLights.py
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
from lib.Program import Program
|
||||||
|
from rpi_ws281x import Color
|
||||||
|
import time
|
||||||
|
|
||||||
|
def name():
|
||||||
|
return 'Christmas Lights'
|
||||||
|
|
||||||
|
class ChristmasLights(Program):
|
||||||
|
def run(self, args: [] = None):
|
||||||
|
# Configuration
|
||||||
|
wait_ms = 0 # Speed of the animation
|
||||||
|
|
||||||
|
# Define classic festive colors
|
||||||
|
RED = Color(255, 0, 0)
|
||||||
|
GREEN = Color(0, 255, 0)
|
||||||
|
WARM_WHITE = Color(200, 180, 60) # A golden-ish warm white
|
||||||
|
|
||||||
|
colors = [RED, GREEN, WARM_WHITE]
|
||||||
|
|
||||||
|
# This determines how many pixels of the same color are next to each other
|
||||||
|
group_size = 2
|
||||||
|
|
||||||
|
offset = 0
|
||||||
|
while self.get_loop().status():
|
||||||
|
num_pixels = self._lm.count_pixels()
|
||||||
|
|
||||||
|
for i in range(num_pixels):
|
||||||
|
# Calculate which color index to use based on pixel position and current offset
|
||||||
|
# This creates the "moving" effect
|
||||||
|
color_index = ((i + offset) // group_size) % len(colors)
|
||||||
|
self._lm.set_pixel_color(i, colors[color_index])
|
||||||
|
|
||||||
|
self._lm.show()
|
||||||
|
|
||||||
|
# Increment offset to move the lights
|
||||||
|
offset = (offset + 1) % (len(colors) * group_size)
|
||||||
|
self._lm.get_tempo().wait()
|
||||||
|
time.sleep(wait_ms / 1000.0)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
from pyleds.lib.Program import Program
|
from lib.Program import Program
|
||||||
from rpi_ws281x import Color
|
from rpi_ws281x import Color
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from pyleds.lib.Program import Program
|
from lib.Program import Program
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from pyleds.lib.Program import Program
|
from lib.Program import Program
|
||||||
|
|
||||||
|
|
||||||
def name():
|
def name():
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from pyleds.lib.Program import Program
|
from lib.Program import Program
|
||||||
from pyleds.lib.Litsimaja import Litsimaja
|
from lib.Litsimaja import Litsimaja
|
||||||
|
|
||||||
|
|
||||||
def Color(red, green, blue):
|
def Color(red, green, blue):
|
||||||
|
|||||||
Reference in New Issue
Block a user