File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ """
2+ Lightbox driver program.
3+
4+ Adafruit invests time and resources providing this open source code.
5+ Please support Adafruit and open source hardware by purchasing
6+ products from Adafruit!
7+
8+ Written by Dave Astels for Adafruit Industries
9+ Copyright (c) 2018 Adafruit Industries
10+ Licensed under the MIT license.
11+
12+ All text above must be included in any redistribution.
13+ """
14+
15+ import board
16+ import neopixel
17+ from adafruit_ble .uart import UARTServer
18+ from adafruit_bluefruit_connect .packet import Packet
19+ from adafruit_bluefruit_connect .color_packet import ColorPacket
20+
21+ pixel_pin = board .A0
22+ num_pixels = 20
23+
24+ pixels = neopixel .NeoPixel (pixel_pin , num_pixels )
25+
26+ uart_server = UARTServer ()
27+
28+ while True :
29+ uart_server .start_advertising ()
30+ while not uart_server .connected :
31+ pass
32+
33+ # Now we're connected
34+
35+ while uart_server .connected :
36+ if uart_server .in_waiting :
37+ packet = Packet .from_stream (uart_server )
38+ if isinstance (packet , ColorPacket ):
39+ # Change the NeoPixel color.
40+ pixels .fill (packet .color )
You can’t perform that action at this time.
0 commit comments