File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change 14
14
15
15
import board
16
16
import 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
+
18
22
from adafruit_bluefruit_connect .packet import Packet
19
23
from adafruit_bluefruit_connect .color_packet import ColorPacket
20
24
23
27
24
28
pixels = neopixel .NeoPixel (pixel_pin , num_pixels )
25
29
26
- uart_server = UARTServer ()
30
+ ble = BLERadio ()
31
+ uart = UARTService ()
32
+ advertisement = ProvideServicesAdvertisement (uart )
27
33
28
34
while True :
29
- uart_server .start_advertising ()
30
- while not uart_server .connected :
35
+ ble .start_advertising (advertisement )
36
+ while not ble .connected :
31
37
pass
32
38
33
39
# Now we're connected
34
40
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 )
38
44
if isinstance (packet , ColorPacket ):
39
45
# Change the NeoPixel color.
40
46
pixels .fill (packet .color )
You can’t perform that action at this time.
0 commit comments