# render label into image draw area draw = ImageDraw.Draw(imgOut) for i in range(n): draw.text((0, sizey * i), label * n, fill=fgcolor, font=font) if rotate_angle: imgOut = imgOut.rotate(rotate_angle) return imgOut def show_text(led, text, x_offset=0, y_offset=0, sleep=0.5): for char in text: img = txt2img(char) arr = np.array(img.getdata()).reshape(img.size[::-1]).T[::, ::-1] for x, y in np.argwhere(arr < 100): led_num = xy_to_led_coordinates(x + x_offset, y - y_offset) led.set(led_num, color_hex("#6bc325")) led.update() time.sleep(sleep) led.all_off() if __name__ == '__main__': led = LEDStrip(100) led.all_off() show_text(led, 'NEVER GRADUATE!', x_offset=3, y_offset=1)
def __init__(self): self.led_strip = LEDStrip(config.LED_COUNT) self.led_strip.set_master_brightness(0.9) self.led_strip.all_off() self.colors = {user['color']: False for user in config.USERS}
from raspledstrip.ledstrip import LEDStrip from raspledstrip.LPD8806 import LPD8806SPI from raspledstrip.animation import AlertStrobe, FillFromCenter, BreathingLight from raspledstrip.color import Color led_strip = LEDStrip(LPD8806SPI(36)) led_strip.all_off() alert_color = Color(255, 0, 0, 1.0) fill_animation = FillFromCenter(led_strip, alert_color) fill_animation.run(1, 30, 18) alert_animation = AlertStrobe(led_strip, alert_color) alert_animation.run(1, 20, 24) led_strip.all_off() fill_animation = BreathingLight(led_strip, 0, 255, 0, 0.1, 1.0, 0, 0) fill_animation.run(1, 30, 1000) led_strip.all_off()