BLUETOOTH DATA RECEPTION ERROR WITH ARDUINO AND PULSE SENSOR!
HI! I dont know if this error is because i making something wrong with data rececption or a im made a bad program in app inventor
im making an app for can see a cardio frequency value (this is sensed by a pulse sensor). i added can see the max frequency or min frequency (i can know the value if i put mi age and select woman or men, THIS NOT DEPEND OF THE SENSOR).
the problem is when i push bottom "body state" i can see the "min" and "max" frequency. but the value in labels "ACTUAL FC" and "CORPORAL STATUS" depend on the sensor. but the value isnt sended, i see a: "?" and the legend THE OPERATION CANNOT ACCEPT THE ARGUMENTS?, 80.
for the arduino code i usE the librarie "pulse sensor playground" from pulsesensor. For send the value i open de monitor serie of arduino and i can see the sensed values. But when i push the "enter" (keyboard) the value is send to screen of app inventor, but i see a "?"
can please someone help me?
links to images
APP INVENTOR SCREEN
APP INVENTOR CODE
THE ARDUINO CODE
`#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; // PulseSensor PURPLE WIRE connected to ANALOG PIN 0
const int LED13 = 13; // The on-board Arduino LED, close to PIN 13.
int Threshold = 550; // Determine which Signal to "count as a beat" and which to ignore.
// Use the "Gettting Started Project" to fine-tune Threshold Value beyond default setting.
// Otherwise leave the default "550" value.
PulseSensorPlayground pulseSensor; // Creates an instance of the PulseSensorPlayground object called "pulseSensor"
void setup() {
Serial.begin(9600); // For Serial Monitor
// Configure the PulseSensor object, by assigning our variables to it.
pulseSensor.analogInput(PulseWire);
pulseSensor.blinkOnPulse(LED13); //auto-magically blink Arduino's LED with heartbeat.
pulseSensor.setThreshold(Threshold);
// Double-check the "pulseSensor" object was created and "began" seeing a signal.
if (pulseSensor.begin()) {
Serial.println("We created a pulseSensor Object !"); //This prints one time at Arduino power-up, or on Arduino reset.
}
}
void loop() {
int myBPM = pulseSensor.getBeatsPerMinute(); // Calls function on our pulseSensor object that returns BPM as an "int".
// "myBPM" hold this BPM value now.
if (pulseSensor.sawStartOfBeat()) { // Constantly test to see if "a beat happened".
Serial.println(myBPM); // Print the value inside of myBPM.
}
delay(20); // considered best practice in a simple sketch.
}