-
-
Notifications
You must be signed in to change notification settings - Fork 330
PlatformIO
Phil Schatzmann edited this page Jul 31, 2021
·
35 revisions
The library has been developed to be used in Arduino, but it can also be used easily in PlatformIO.
-
Create a new PlatformIO Project.
-
Update the platformio.ini file in the root of the project:
[platformio]
description = A2DP Example
default_envs = esp32dev
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps = https://github.com/pschatzmann/ESP32-A2DP
build_flags = -DCORE_DEBUG_LEVEL=5
monitor_speed = 115200
- Add your desired Arduino sketch into the src directory e.g.
#include "BluetoothA2DPSink.h"
BluetoothA2DPSink a2dp_sink;
void setup() {
Serial.begin(115200);
a2dp_sink.start("MyMusic");
}
void loop() {
}
The file name does not matter - you could use e.g. simple.ino or main.cpp. You could take e.g. any sketch from the samples directory.
-
Compile the project
-
Upload the binary
-
Open a new Platformio Terminal and confirm that you get log messages:
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:10124
load:0x40080400,len:5828
entry 0x400806a8
[D][BluetoothA2DPSink.cpp:154] start(): start
[I][BluetoothA2DPSink.cpp:159] start(): Device name will be set to 'MyMusic'
[D][BluetoothA2DPSink.cpp:735] init_nvs(): init_nvs
[D][BluetoothA2DPSink.cpp:751] get_last_connection(): get_last_connection
[D][BluetoothA2DPSink.cpp:222] init_bluetooth(): init_bluetooth
[I][BluetoothA2DPSink.cpp:227] init_bluetooth(): controller initialized
[I][BluetoothA2DPSink.cpp:236] init_bluetooth(): bluedroid initialized
[I][BluetoothA2DPSink.cpp:244] init_bluetooth(): bluedroid enabled
[D][BluetoothA2DPSink.cpp:326] app_task_start_up(): app_task_start_up
[D][BluetoothA2DPSink.cpp:879] app_task_handler_2(): app_task_handler_2
[D][BluetoothA2DPSink.cpp:852] app_task_handler(): app_task_handler
[D][BluetoothA2DPSink.cpp:299] app_task_handler(): app_task_handler
[D][BluetoothA2DPSink.cpp:251] app_work_dispatch(): app_work_dispatch event 0x0, param len 0
[D][BluetoothA2DPSink.cpp:283] app_send_msg(): app_send_msg
[D][BluetoothA2DPSink.cpp:306] app_task_handler(): app_task_handler, sig 0x1, 0x0
[W][BluetoothA2DPSink.cpp:309] app_task_handler(): app_task_handler, APP_SIG_WORK_DISPATCH sig: 1
[D][BluetoothA2DPSink.cpp:274] app_work_dispatched(): app_work_dispatched
[D][BluetoothA2DPSink.cpp:176] operator()(): av_hdl_stack_evt_2
[D][BluetoothA2DPSink.cpp:583] av_hdl_stack_evt(): av_hdl_stack_evt evt 0
[D][BluetoothA2DPSink.cpp:588] av_hdl_stack_evt(): av_hdl_stack_evt av_hdl_stack_evt BT_APP_EVT_STACK_UP
[D][BluetoothA2DPSink.cpp:597] av_hdl_stack_evt(): AVRCP controller initialized!
[D][BluetoothA2DPSink.cpp:621] av_hdl_stack_evt(): esp_bt_gap_set_scan_mode(ESP_BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE)
- Make adjustments
- You can extend the sketch with your own logic
- After you confirmed that everything is working you should consider to lower the lower the debug level in platformio.ini
I was using the lib_deps functionality. As an alternative you could remove the lib_deps = https://github.com/pschatzmann/ESP32-A2DP
and do a git clone https://github.com/pschatzmann/ESP32-A2DP
into the lib folder