I was trying to compile the example provided, I changed the pwm pin but that should not have done much.
// A2DPSink example - Released to the public domain in 2024 by Earle F. Philhower, III
// Hook up a phono plug to GP0 and GP1 (and GND of course...the 1st 3 pins on the PCB)
// Connect wired earbuds up and connect over BT from your phone and play some music.
#include <BluetoothAudio.h>
#include <PWMAudio.h>
PWMAudio pwm(16, true);
A2DPSink a2dp;
volatile A2DPSink::PlaybackStatus status = A2DPSink::STOPPED;
void volumeCB(void *param, int pct) {
(void) param;
Serial.printf("Speaker volume changed to %d%%\n", pct);
}
void connectCB(void *param, bool connected) {
(void) param;
if (connected) {
Serial.printf("A2DP connection started to %s\n", bd_addr_to_str(a2dp.getSourceAddress()));
} else {
Serial.printf("A2DP connection stopped\n");
}
}
void playbackCB(void *param, A2DPSink::PlaybackStatus state) {
(void) param;
status = state;
}
void setup() {
Serial.begin(115200);
delay(3000);
Serial.printf("Starting, connect to the PicoW and start playing music\n");
Serial.printf("Use BOOTSEL to pause/resume playback\n");
a2dp.setName("PicoW Boom 00:00:00:00:00:00");
a2dp.setConsumer(new BluetoothAudioConsumerPWM(pwm));
a2dp.onVolume(volumeCB);
a2dp.onConnect(connectCB);
a2dp.onPlaybackStatus(playbackCB);
a2dp.begin();
}
void loop() {
if (BOOTSEL) {
__lockBluetooth();
if (status == A2DPSink::PAUSED) {
a2dp.play();
Serial.printf("Resuming\n");
} else if (status == A2DPSink::PLAYING) {
a2dp.pause();
Serial.printf("Pausing\n");
}
__unlockBluetooth();
while (BOOTSEL);
}
}
The error I get while compiling is:
In file included from C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/BluetoothAudio.h:4,
from C:\Users\gottem\AppData\Local\Temp\.arduinoIDE-unsaved202454-17268-16jvx9s.8v1u\A2DPSink\A2DPSink.ino:7:
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/BluetoothMediaConfigurationSBC.h:34:5: error: 'btstack_sbc_channel_mode_t' does not name a type
34 | btstack_sbc_channel_mode_t channel_mode;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/BluetoothMediaConfigurationSBC.h:35:5: error: 'btstack_sbc_allocation_method_t' does not name a type
35 | btstack_sbc_allocation_method_t allocation_method;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/BluetoothAudio.h:5:
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSource.h:59:37: error: 'avrcp_operation_id_t' has not been declared
59 | void onAVRCP(void (*cb)(void *, avrcp_operation_id_t, int), void *cbData = nullptr) {
| ^~~~~~~~~~~~~~~~~~~~
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSource.h:64:39: error: 'avrcp_battery_status_t' has not been declared
64 | void onBattery(void (*cb)(void *, avrcp_battery_status_t), void *cbData = nullptr) {
| ^~~~~~~~~~~~~~~~~~~~~~
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSource.h:157:30: error: 'avrcp_operation_id_t' has not been declared
157 | void (*_avrcpCB)(void *, avrcp_operation_id_t, int) = nullptr;
| ^~~~~~~~~~~~~~~~~~~~
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSource.h:159:32: error: 'avrcp_battery_status_t' has not been declared
159 | void (*_batteryCB)(void *, avrcp_battery_status_t) = nullptr;
| ^~~~~~~~~~~~~~~~~~~~~~
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSource.h:202:5: error: 'btstack_sbc_encoder_state_t' does not name a type; did you mean 'btstack_hid_parser_state_t'?
202 | btstack_sbc_encoder_state_t sbc_encoder_state;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
| btstack_hid_parser_state_t
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSource.h:209:9: error: 'avrcp_playback_status_t' does not name a type
209 | avrcp_playback_status_t status;
| ^~~~~~~~~~~~~~~~~~~~~~~
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSource.h:230:5: error: 'avrcp_track_t' does not name a type
230 | avrcp_track_t _currentTrack;
| ^~~~~~~~~~~~~
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSource.h:167:10: error: 'AVDTP_SBC_44100' was not declared in this scope
167 | (AVDTP_SBC_44100 << 4) | AVDTP_SBC_STEREO,
| ^~~~~~~~~~~~~~~
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSource.h:167:34: error: 'AVDTP_SBC_STEREO' was not declared in this scope
167 | (AVDTP_SBC_44100 << 4) | AVDTP_SBC_STEREO,
| ^~~~~~~~~~~~~~~~
In file included from C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/BluetoothAudio.h:6:
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h:83:37: error: 'avrcp_operation_id_t' has not been declared
83 | void onAVRCP(void (*cb)(void *, avrcp_operation_id_t, int), void *cbData = nullptr) {
| ^~~~~~~~~~~~~~~~~~~~
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h:88:39: error: 'avrcp_battery_status_t' has not been declared
88 | void onBattery(void (*cb)(void *, avrcp_battery_status_t), void *cbData = nullptr) {
| ^~~~~~~~~~~~~~~~~~~~~~
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h:227:67: error: 'avdtp_sbc_codec_header_t' has not been declared
227 | int read_sbc_header(uint8_t * packet, int size, int * offset, avdtp_sbc_codec_header_t * sbc_header);
| ^~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h:228:72: error: 'avdtp_media_packet_header_t' has not been declared
228 | int read_media_data_header(uint8_t *packet, int size, int *offset, avdtp_media_packet_header_t *media_header);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h:242:30: error: 'avrcp_operation_id_t' has not been declared
242 | void (*_avrcpCB)(void *, avrcp_operation_id_t, int) = nullptr;
| ^~~~~~~~~~~~~~~~~~~~
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h:244:32: error: 'avrcp_battery_status_t' has not been declared
244 | void (*_batteryCB)(void *, avrcp_battery_status_t) = nullptr;
| ^~~~~~~~~~~~~~~~~~~~~~
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h:273:5: error: 'btstack_sbc_decoder_state_t' does not name a type; did you mean 'btstack_hid_parser_state_t'?
273 | btstack_sbc_decoder_state_t state;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
| btstack_hid_parser_state_t
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h:274:5: error: 'btstack_sbc_mode_t' does not name a type; did you mean 'btstack_time_t'?
274 | btstack_sbc_mode_t mode = SBC_MODE_STANDARD;
| ^~~~~~~~~~~~~~~~~~
| btstack_time_t
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h:299:5: error: 'avrcp_battery_status_t' does not name a type
299 | avrcp_battery_status_t battery_status = AVRCP_BATTERY_STATUS_WARNING;
| ^~~~~~~~~~~~~~~~~~~~~~
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h: In member function 'void A2DPSink::play()':
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h:135:13: error: 'avrcp_controller_play' was not declared in this scope
135 | avrcp_controller_play(a2dp_sink_avrcp_connection.avrcp_cid);
| ^~~~~~~~~~~~~~~~~~~~~
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h: In member function 'void A2DPSink::stop()':
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h:142:13: error: 'avrcp_controller_stop' was not declared in this scope
142 | avrcp_controller_stop(a2dp_sink_avrcp_connection.avrcp_cid);
| ^~~~~~~~~~~~~~~~~~~~~
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h: In member function 'void A2DPSink::pause()':
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h:149:13: error: 'avrcp_controller_pause' was not declared in this scope; did you mean 'avrcp_controller_packet_handler'?
149 | avrcp_controller_pause(a2dp_sink_avrcp_connection.avrcp_cid);
| ^~~~~~~~~~~~~~~~~~~~~~
| avrcp_controller_packet_handler
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h: In member function 'void A2DPSink::fastForward()':
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h:156:13: error: 'avrcp_controller_fast_forward' was not declared in this scope; did you mean 'avrcp_controller_packet_handler'?
156 | avrcp_controller_fast_forward(a2dp_sink_avrcp_connection.avrcp_cid);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| avrcp_controller_packet_handler
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h: In member function 'void A2DPSink::rewind()':
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h:163:13: error: 'avrcp_controller_rewind' was not declared in this scope; did you mean 'avrcp_controller_packet_handler'?
163 | avrcp_controller_rewind(a2dp_sink_avrcp_connection.avrcp_cid);
| ^~~~~~~~~~~~~~~~~~~~~~~
| avrcp_controller_packet_handler
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h: In member function 'void A2DPSink::forward()':
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h:170:13: error: 'avrcp_controller_forward' was not declared in this scope
170 | avrcp_controller_forward(a2dp_sink_avrcp_connection.avrcp_cid);
| ^~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h: In member function 'void A2DPSink::backward()':
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h:177:13: error: 'avrcp_controller_backward' was not declared in this scope; did you mean 'avrcp_controller_packet_handler'?
177 | avrcp_controller_backward(a2dp_sink_avrcp_connection.avrcp_cid);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
| avrcp_controller_packet_handler
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h: In member function 'void A2DPSink::volumeUp()':
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h:184:13: error: 'avrcp_controller_volume_up' was not declared in this scope
184 | avrcp_controller_volume_up(a2dp_sink_avrcp_connection.avrcp_cid);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h: In member function 'void A2DPSink::volumeDown()':
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h:191:13: error: 'avrcp_controller_volume_down' was not declared in this scope
191 | avrcp_controller_volume_down(a2dp_sink_avrcp_connection.avrcp_cid);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h: In member function 'void A2DPSink::mute()':
C:\Users\gottem\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.9.1\libraries\BluetoothAudio\src/A2DPSink.h:198:13: error: 'avrcp_controller_mute' was not declared in this scope
198 | avrcp_controller_mute(a2dp_sink_avrcp_connection.avrcp_cid);
| ^~~~~~~~~~~~~~~~~~~~~
exit status 1
Compilation error: exit status 1
Not sure if i am missing something, but I already tried restarting my IDE and even updated to 3.9.1.
I was trying to compile the example provided, I changed the pwm pin but that should not have done much.
The error I get while compiling is:
Not sure if i am missing something, but I already tried restarting my IDE and even updated to 3.9.1.