Library version is 3.1.6 updated on 31.05.21
Bluetooth module is HC-05
On board - Arduino Nano
Following sketch is written for showing Heart Rate from pulse sensor via analog pin A0. Pin 2 and 3 is used as Software serial pins. Board is powered by laptop and the powering cable is fine because other program written using hardware serial works just fine.
<<<<<<
//////////////////////////////////////////////
// RemoteXY include library //
//////////////////////////////////////////////
// RemoteXY select connection mode and include library
#define REMOTEXY_MODE__SOFTSERIAL
#include <SoftwareSerial.h>
#include <RemoteXY.h>
// RemoteXY connection settings
#define REMOTEXY_SERIAL_RX 2
#define REMOTEXY_SERIAL_TX 3
#define REMOTEXY_SERIAL_SPEED 19200
#define REMOTEXY_ACCESS_PASSWORD "0000"
// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
{ 255,0,0,15,0,31,0,11,26,0,
67,5,67,32,19,8,2,26,11,129,
0,69,23,16,7,31,66,80,77,0,
68,17,7,16,51,30,8,36 };
// this structure defines all the variables and events of your control interface
struct {
// output variables
char text_1[11]; // string UTF8 end zero
float onlineGraph_1;
// other variable
uint8_t connect_flag; // =1 if wire connected, else =0
} RemoteXY;
#pragma pack(pop)
/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////
#define USE_ARDUINO_INTERRUPTS true // Set-up low-level interrupts for most acurate BPM math.
#include <PulseSensorPlayground.h> // Includes the PulseSensorPlayground Library.
// Variables
const int PulseWire = 0;
int Threshold = 510;
PulseSensorPlayground pulseSensor;
void setup() {
RemoteXY_Init ();
pulseSensor.begin(); //This Function is to initialize the whole library function.
pulseSensor.analogInput(PulseWire);
pulseSensor.setThreshold(Threshold);
}
void loop() {
RemoteXY_Handler ();
RemoteXY.onlineGraph_1 = float (analogRead(A2));
int myBPM = pulseSensor.getBeatsPerMinute();
if (pulseSensor.sawStartOfBeat()) {
dtostrf(myBPM, 0, 2, RemoteXY.text_1);
}
}
>>>>>
bluetooth is powered by 5v pin from the arduino. I have changed it to 3.3v , but it didn't solve the problem.
When the sketch is written for hardware serial, RemoteXY (pro- purchased 5 days ago) app runs well but the variables are found to be scrambled due to pulse created by bluetooth.
When the sketch is written for software serial (for any pins), the mobile app fails to connect. Sometimes it shows GUI configuration problem, sometimes it shows variables error. Only a few times the app could run the program, but it crashed within a few seconds showing an message " Board did not reply. "