""" Lightbox driver program. Adafruit invests time and resources providing this open source code. Please support Adafruit and open source hardware by purchasing products from Adafruit! Written by Dave Astels for Adafruit Industries Copyright (c) 2018 Adafruit Industries Licensed under the MIT license. All text above must be included in any redistribution. """ import board import neopixel from adafruit_ble.uart import UARTServer from adafruit_bluefruit_connect.packet import Packet from adafruit_bluefruit_connect.color_packet import ColorPacket pixel_pin = board.A0 num_pixels = 20 pixels = neopixel.NeoPixel(pixel_pin, num_pixels) uart_server = UARTServer() while True: uart_server.start_advertising() while not uart_server.connected: pass # Now we're connected while uart_server.connected: if uart_server.in_waiting: packet = Packet.from_stream(uart_server) if isinstance(packet, ColorPacket): # Change the NeoPixel color. pixels.fill(packet.color)