Connect the Argon to an embeded system

Hy everybody! I would like to connect my Particle Argon to an STM32WB55 dev board via Bluetooth to send commands to it from the cloud. The wifi part works, but I am stuck with the BLE part. I would like to ask your help to find a way to connect and communicate with the STM32WB55. I tried to blink the LED in the workshop example: You can find the bluetooth LED blink project after installation of the software used on the ws. The project is located in the HandsOn_3 folder in the zip file.

Here is my code:

#include "Particle.h"

// This example does not require the cloud so you can run it in manual mode or
// normal cloud-connected mode

const size_t UART_TX_BUF_SIZE = 20;

int new_message=0;
String message="";
bool BLE_previously_connected=false;
uint8_t txBuf[UART_TX_BUF_SIZE];
size_t txLen = 0;
void onDataReceived(const uint8_t* data, size_t len, const BlePeerDevice& peer, void* context);

// These UUIDs were defined by Nordic Semiconductor and are now the defacto standard for
// UART-like services over BLE. Many apps support the UUIDs now, like the Adafruit Bluefruit app.

const unsigned long SCAN_PERIOD_MS = 2000;
unsigned long lastScan = 0;

const size_t SCAN_RESULT_COUNT = 20;

BleScanResult scanResults[SCAN_RESULT_COUNT];
BlePeerDevice peer;

BleCharacteristic peerTxCharacteristic;
BleCharacteristic peerRxCharacteristic;

const BleUuid serviceUuid("0000FE40-CC7A-482A-984A-7F2ED5B3E58F");
const BleUuid rxUuid("0000FE42-8E22-4541-9D4C-21EDAE82ED19");
const BleUuid txUuid("0000FE41-8E22-4541-9D4C-21EDAE82ED19");

void onDataReceived(const uint8_t* data, size_t len, const BlePeerDevice& peer, void* context) {
    Particle.publish("Message Receive",String((char *) data,len),PUBLIC);

void setup() {
    size_t offset = 0;
    uint8_t buf[BLE_MAX_ADV_DATA_LEN];
    peerTxCharacteristic.onDataReceived(onDataReceived, &peerTxCharacteristic);

void loop() {
    if (BLE.connected()) {
        txLen = 0;
        if(!BLE_previously_connected) //new connection
            for(int i=0;i<message.length();i++)
        if (txLen > 0) {
            peerRxCharacteristic.setValue(txBuf, txLen);
        if (millis() - lastScan >= SCAN_PERIOD_MS) {
            // Time to scan
            lastScan = millis();

            size_t count = BLE.scan(scanResults, SCAN_RESULT_COUNT);
            if (count > 0) {
                for (uint8_t ii = 0; ii < count; ii++) {
                    BleUuid foundServiceUuid;
                    size_t svcCount = scanResults[ii].advertisingData.serviceUUID(&foundServiceUuid, 1);
                    if(svcCount > 0 && foundServiceUuid == serviceUuid){
                        Particle.publish("Found service, trying to connect...","True");
                        peer = BLE.connect(scanResults[ii].address);
                        //end of debug
                        if (peer.connected()) {
                            peerTxCharacteristic = peer.getCharacteristicByUUID(txUuid);
                            peerRxCharacteristic = peer.getCharacteristicByUUID(rxUuid);

int messageHandler(String s)
    return 0;

You don’t really ask people to install something in order to be able to help you solve your problem, do you?


Without the software on the STM microcontroller no one will be able to reproduce the working environment that I use. I felt it problematic to share the code any other way. I could upload the LED blinking code to Github but I didn’t contributed to it. I used it as it is. I have ethical problems sharing someone’s code any other way. That’s why, I linked the source where I have found it. I am open to your suggestion.