File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414
1515import board
1616import neopixel
17- from adafruit_ble .uart import UARTServer
17+
18+ from adafruit_ble import BLERadio
19+ from adafruit_ble .advertising .standard import ProvideServicesAdvertisement
20+ from adafruit_ble .services .nordic import UARTService
21+
1822from adafruit_bluefruit_connect .packet import Packet
1923from adafruit_bluefruit_connect .color_packet import ColorPacket
2024
2327
2428pixels = neopixel .NeoPixel (pixel_pin , num_pixels )
2529
26- uart_server = UARTServer ()
30+ ble = BLERadio ()
31+ uart = UARTService ()
32+ advertisement = ProvideServicesAdvertisement (uart )
2733
2834while True :
29- uart_server .start_advertising ()
30- while not uart_server .connected :
35+ ble .start_advertising (advertisement )
36+ while not ble .connected :
3137 pass
3238
3339 # Now we're connected
3440
35- while uart_server .connected :
36- if uart_server .in_waiting :
37- packet = Packet .from_stream (uart_server )
41+ while ble .connected :
42+ if uart .in_waiting :
43+ packet = Packet .from_stream (uart )
3844 if isinstance (packet , ColorPacket ):
3945 # Change the NeoPixel color.
4046 pixels .fill (packet .color )
You can’t perform that action at this time.
0 commit comments