def get(self): start = time.time() pixels.power.on() while time.time() - start < 3: pixels.show([255] * 48) time.sleep(0.3) pixels.show([255, 0, 0] * 16) time.sleep(0.3) pixels.power.off() return "Success"
def thread_water(): while True: if boolWaterlight == 1: data = [255, 0, 0, 0, 0, 0, 0, 0, 0] pixels.show(data) time.sleep(0.4) data = [0, 0, 0, 0, 255, 0, 0, 0, 0] pixels.show(data) time.sleep(0.4) data = [0, 0, 0, 0, 0, 0, 0, 0, 255] pixels.show(data) time.sleep(0.4) data = [0, 0, 0, 0, 0, 0, 0, 0, 0] pixels.show(data) time.sleep(0.4) else: time.sleep(1)
import time from pixels import Pixels, pixels from alexa_led_pattern import AlexaLedPattern from google_home_led_pattern import GoogleHomeLedPattern if __name__ == '__main__': pixels.pattern = GoogleHomeLedPattern(show=pixels.show) while True: try: data =[255,0,0] * 3 pixels.show(data) time.sleep(2) data =[0,255,0] * 3 pixels.show(data) time.sleep(2) data =[0,0,255] * 3 pixels.show(data) time.sleep(2) data =[255,0,255] * 3 pixels.show(data) time.sleep(2) data =[0,0,0] * 3 pixels.show(data) time.sleep(2) pixels.show(data)