Toggle Navigation
TiDAL Hatchery
Eggs
LEDCycling
__init__.py
Users
Badges
Login
Register
__init__.py
raw
Content
from tidal import * from colorsys import hsv_to_rgb from app import TextApp class LEDCycle(TextApp): TITLE = "LEDCycle" BG = BLACK FG = WHITE HUE_STEP = 0.05 TIME_STEP = 50 def __init__(self): super().__init__() self.led_h = 0.0 self.led_s = 1.0 self.led_v = 1.0 self.timer = None self.led = led def draw_screen(self): self.window.println("Hello world!") self.window.println() self.window.println("Hue: {}".format(self.led_h)) self.window.println("Sat: {}".format(self.led_s)) self.window.println("Val: {}".format(self.led_v)) def update_led(self): self.led[0] = hsv_to_rgb(self.led_h, self.led_s, self.led_v) self.led.write() if self.is_active(): self.draw_screen() def shutdown(self): if self.timer is not None: self.timer.cancel() self.timer = None self.timer = None led_power_off() def exit(self): self.shutdown() def on_start(self): super().on_start() led_power_on() self.update_led() def on_activate(self): super().on_activate() self.draw_screen() def on_stop(self): self.shutdown() main = LEDCycle