You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
676 B
Python
32 lines
676 B
Python
#!/usr/bin/python3
|
|
|
|
from omnia import leds
|
|
from random import randint
|
|
from time import sleep
|
|
import pygame_demo as demo
|
|
|
|
strip = demo.my_strip
|
|
|
|
def set_leds(br):
|
|
br = max(1, br)
|
|
r, g, b = 1, 0, 0
|
|
st = leds.LedState(int(r*br), int(g*br), int(b*br), 1, False)
|
|
strip.apply([st], leds.PatternFitting.Repeat)
|
|
|
|
def continuous_brightness_change(start, step, stop, wait):
|
|
for x in range(start, stop, step):
|
|
set_leds(x)
|
|
# sleep(wait)
|
|
|
|
def inhale():
|
|
print('inhaling')
|
|
continuous_brightness_change(-30, 1, 128, .02)
|
|
def exhale():
|
|
print('exhaling')
|
|
continuous_brightness_change(128, -1, -30, .02)
|
|
|
|
|
|
while True:
|
|
inhale()
|
|
exhale()
|