def anim(value): light.stopAnim() anim = None try: anim = anims[value] light.stopAnim() light.startAnim(anim) except KeyError: light.showDefaultColor light.update() return value
def setValue(value): light.stopAnim() light.setValue(value) light.update() return repr(light.getColor())
def showDefaultColor(): light.stopAnim() light.showDefaultColor() light.update() return repr(light.getColor())
def off(): light.stopAnim() light.setValue(0) light.update() return repr(light.getColor())
import stripeclock driver = DriverLPD8806(num = 60, c_order = ChannelOrder.BRG) #load the LEDMatrix class from bibliopixel.led import * #change rotation and vert_flip as needed by your display led = LEDMatrix(driver, width=10, height=6, serpentine = False, rotation = MatrixRotation.ROTATE_0, vert_flip = False) app = Flask(__name__) app.debug = True light = light.Light(led, (255, 192, 128)) light.show_default_color() light.update() anims = { "leuchtturm": leuchtturm.Leuchtturm(led, period = 5), "stripeclock": stripeclock.StripeClock(led, backgroundColor = light.get_color_scaled()) } @app.route("/") def hello(): return "Hello World!" @app.route("/showDefaultColor", methods = ["PUT"]) def showDefaultColor(): light.stopAnim() light.showDefaultColor() light.update()