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.
31 lines
609 B
Python
31 lines
609 B
Python
#!/usr/bin/python3
|
|
|
|
from omnia import leds
|
|
from random import randint
|
|
from time import sleep
|
|
|
|
strip = leds.OmniaStrip
|
|
|
|
def set_leds(br):
|
|
for led in strip:
|
|
st = led.state
|
|
st.brightness = br
|
|
st.autonomous = False
|
|
led.set(st)
|
|
|
|
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(0, 30, 255, .1)
|
|
def exhale():
|
|
print('exhaling')
|
|
continuous_brightness_change(255, -30, 0, .1)
|
|
|
|
while True:
|
|
inhale()
|
|
exhale()
|