# SPDX-FileCopyrightText: 2020 Melissa LeBlanc-Williams, written for Adafruit Industries # SPDX-License-Identifier: MIT import board import neopixel from adafruit_pixel_framebuf import PixelFramebuffer, VERTICAL pixel_pin = board.D6 pixel_width = 32 pixel_height = 8 pixels = neopixel.NeoPixel( pixel_pin, pixel_width * pixel_height, brightness=0.1, auto_write=False, ) pixel_framebuf = PixelFramebuffer(pixels, pixel_width, pixel_height, orientation=VERTICAL, rotation=2) pixel_framebuf.fill(0x000088) pixel_framebuf.pixel(2, 1, 0xFFFF00) pixel_framebuf.line(0, 0, pixel_width - 1, pixel_height - 1, 0x00FF00) pixel_framebuf.line(0, pixel_height - 1, pixel_width - 1, 0, 0x00FF00) pixel_framebuf.circle(pixel_width // 2 - 1, pixel_height // 2 - 1, 4, 0xFF0000) pixel_framebuf.rect(1, 2, 8, pixel_height - 3, 0xFF00FF) pixel_framebuf.display()
PURPLE = (180, 0, 255) TWINKLEY = (255, 255, 255) OFF = (0, 0, 0) # Setup Dotstar grid and pixel framebuffer for fancy animations pixel_width = 8 pixel_height = 8 num_pixels = pixel_width * pixel_height pixels = adafruit_dotstar.DotStar(board.A1, board.A2, num_pixels, auto_write=False, brightness=0.1) pixel_framebuf = PixelFramebuffer(pixels, pixel_width, pixel_height, rotation=1, alternating=False, reverse_x=True) # Fancy animations from https://learn.adafruit.com/circuitpython-led-animations rainbow_chase = RainbowChase(pixels, speed=0.1, size=3, spacing=6, step=8) chase = Chase(pixels, speed=0.1, color=CYAN, size=3, spacing=6) rainbow_comet = RainbowComet(pixels, speed=0.1, tail_length=5, bounce=True, colorwheel_offset=170) def scroll_framebuf_neg_x(word, color, shift_x, shift_y): pixel_framebuf.fill(0) color_int = int('0x%02x%02x%02x' % color, 16)
from adafruit_pixel_framebuf import PixelFramebuffer pixel_pin = board.D6 pixel_width = 16 pixel_height = 16 pixels = neopixel.NeoPixel( pixel_pin, pixel_width * pixel_height, brightness=0.1, auto_write=False, ) pixel_framebuf = PixelFramebuffer( pixels, pixel_width, pixel_height, reverse_x=True, ) text = "Welcome to CircuitPython" while True: for i in range(6 * len(text) + pixel_width): pixel_framebuf.fill(0x000088) pixel_framebuf.pixel(2, 1, 0x00FFFF) pixel_framebuf.line(0, 0, pixel_width - 1, pixel_height - 1, 0x00FF00) pixel_framebuf.line(0, pixel_width - 1, pixel_height - 1, 0, 0x00FF00) pixel_framebuf.fill_rect(2, 3, 12, 10, 0x000000) pixel_framebuf.text(text, pixel_width - i, 4, 0xFFFF00) pixel_framebuf.rect(1, 2, 14, 12, 0xFF0000) pixel_framebuf.line(0, 2, 0, 14, 0x000088)
""" This example runs on an Adafruit Dotstar Feather """ import board import adafruit_dotstar from adafruit_pixel_framebuf import PixelFramebuffer pixel_pin = board.D6 pixel_width = 12 pixel_height = 6 pixels = adafruit_dotstar.DotStar( board.D13, board.D11, pixel_width * pixel_height, brightness=0.3, auto_write=False, ) pixel_framebuf = PixelFramebuffer( pixels, pixel_width, pixel_height, alternating=False, ) pixel_framebuf.fill(0x000088) pixel_framebuf.pixel(5, 1, 0xFFFF00) pixel_framebuf.line(0, 0, pixel_width - 1, pixel_height - 1, 0x00FF00) pixel_framebuf.display()
print("WiFi secrets are kept in secrets.py, please add them there!") raise AIO_USERNAME = secrets["aio_username"] AIO_KEY = secrets["aio_key"] # LED matrix creation PIXELS = neopixel.NeoPixel( PIXEL_PIN, PIXEL_WIDTH * PIXEL_HEIGHT, brightness=0.5, auto_write=False, ) PIXEL_FRAMEBUF = PixelFramebuffer(PIXELS, PIXEL_WIDTH, PIXEL_HEIGHT, alternating=True, rotation=1, reverse_x=True) # Adafruit.io feeds setup QUOTE_FEED = "sign-quotes.signtext" COLOR_FEED = "sign-quotes.signcolor" CURRENT_TEXT = "Merry Christmas!" CURRENT_COLOR = 0xFFFFFF # Helper function to get updated data from Adafruit.io def update_data(): global CURRENT_TEXT, CURRENT_COLOR print("Updating data from Adafruit IO") try: