I have many times professed my love for the outstanding Raspberry Pi Pico, but only recently did I start working with the Pico-W. The regular Pico is still my go-to solution for most embedded projects, but I've already done a few projects that need wireless connectivity and I feel silly using NRF24 radios and building my own controllers when I could just control my devices from my phone with Bluetooth. Of course, for the first several months after the Pico-W was released, it didn't have functional bluetooth. The hardware was there, but the SDK didn't yet support it. Apparently that was due to the complexity of having wifi and Bluetooth connect to the RP2040 over a single SPI bus. But that has been figured out and as of a few months ago we do have Bluetooth functionality, so I decided to try it out.
As of 2023-June, there is not a lot of support for the new Bluetooth functionality. There is the SDK itself (with examples) and Raspberry Pi Foundation's documentation, but the new BT examples are significantly more opaque and difficult to build than previous examples. As far as community support, I've found several StackOverflow and Reddit pages that contain incomplete conversations or questions without answers, and a few blogs that contain incomplete or clearly broken demos. (There are more blog examples for MicroPython, but no functional examples for C++ that I've found) After a few evenings of trial and error, I did finally figure out how to build the SDK examples and also how to create new standalone projects that use Bluetooth. Since I expect I'll forget what I've learned in the future, I'm writing down an outline here, and putting all of the demos I create into a git repo.
So here it is, a repo that contains the demos that I've written so far along with minimal notes that should enable users to get some extremely basic Bluetooth demos up and running without too many problems. Bluetooth requires SDK 1.5.0, and 1.5.1 was just released which provided MicroPython support for Bluetooth (though I've only ever used C++), so these demos expect that SDK 1.5.1 or higher is available.
The confusing thing for me was that the BT example code isn't contained in the pico-examples repo. Instead the pico-examples library links to the pico-sdk library. And then the BT examples are set up in such a way that they're not as easily built through VSCode. (This might be fully explained in the RPi Documentation, but I didn't read through the hundreds of pages of that, I just wanted a blink demo) So my repo contains a blink demo and also a BT-pair demo where one board transmits its temperature sensor reading (I didn't even know they had built-in temperature sensors) and the other reads the transmitted temperature and blinks to indicate receipt. Hopefully those should work as decent starter code for a variety of BT projects.