File tree Expand file tree Collapse file tree
Circuit_Playground_Bluefruit_Pumpkin Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33
44import time
55import board
6+ import digitalio
67import neopixel
7- from adafruit_ble .uart_server import UARTServer
8+
9+ from adafruit_ble import BLERadio
10+ from adafruit_ble .advertising .standard import ProvideServicesAdvertisement
11+ from adafruit_ble .services .nordic import UARTService
12+
813from audiopwmio import PWMAudioOut as AudioOut
914from audiocore import WaveFile
1015
2429YELLOW = (255 ,230 , 0 )
2530BLUE = (0 , 0 , 255 )
2631# setup bluetooth
27- uart_server = UARTServer ()
32+ ble = BLERadio ()
33+ uart_service = UARTService ()
34+ advertisement = ProvideServicesAdvertisement (uart_service )
2835
2936# External Audio Stuff
37+ speaker_enable = digitalio .DigitalInOut (board .SPEAKER_ENABLE )
38+ speaker_enable .direction = digitalio .Direction .OUTPUT
39+ speaker_enable .value = True
40+
3041audio = AudioOut (board .SPEAKER ) # Speaker
3142wave_file = None
3243
@@ -51,17 +62,17 @@ def play_wav(name, loop=False):
5162
5263while True :
5364 # set CPXb up so that it can be discovered by the app
54- uart_server .start_advertising ()
55- while not uart_server .connected :
65+ ble .start_advertising (advertisement )
66+ while not ble .connected :
5667 pass
5768
5869 # Now we're connected
5970
60- while uart_server .connected :
71+ while ble .connected :
6172
62- if uart_server .in_waiting :
73+ if uart_service .in_waiting :
6374 try :
64- packet = Packet .from_stream (uart_server )
75+ packet = Packet .from_stream (uart_service )
6576 except ValueError :
6677 continue # or pass.
6778
You can’t perform that action at this time.
0 commit comments