I’m not sure if I’m even thinking about this right. I have a Photon with old-style bluetooth HC-06 attached to TX/RX that I use successfully with Serial1.read and .printf. Works great. For packaging reasons I’m trying to replace with Argon BLE UART. The tutorial examples don’t work for me. The error messages on the various Android (Pixel 5a) apps are “Discovering services…error connecting…” of that nature. Some of the apps appear to connect then disconnect right away. I’m using the basic BLE UART example plus the BleSerialPeripheralRK library that packages basic operations into class. I use OS 5.1.0 Argon but same thing has happened with other versions. Below is the ino. The same thing happens using iPhone with nRF Toolbox app so I think I’ve ruled out Android issue. After hours I’m wondering if I need a reality reset from somebody. Am I even framing my work properly?
/*
- Project ble_soc1a_test
- Description:
- Author:
- Date:
*/
#include “BleSerialPeripheralRK.h”
SerialLogHandler logHandler;
SYSTEM_THREAD(ENABLED);
// First parameter is the transmit buffer size, second parameter is the receive buffer size
BleSerialPeripheralStatic<256, 256> bleSerial;
const unsigned long TRANSMIT_PERIOD_MS = 2000;
unsigned long lastTransmit = 0;
int counter = 0;
void setup() {
Serial.begin();
// This must be called from setup()!
bleSerial.setup();
bleSerial.advertise();
}
void loop() {
// This must be called from loop() on every call to loop.
bleSerial.loop();
// Print out anything we receive
if(bleSerial.available()) {
String s = bleSerial.readString();
Log.info("received: %s", s.c_str());
}
if (millis() - lastTransmit >= TRANSMIT_PERIOD_MS) {
lastTransmit = millis();
// Every two seconds, send something to the other side
bleSerial.printlnf("testing %d", ++counter);
Log.info("counter=%d", counter);
}
}