HC-06 and Heart sensor ca not talk

Hello everyone,

i have :

Bluetooth HC-06
Pulsesensor Pulse Heart Rate Sensor

Arduino uno 3

i used an app on Android called “Bluetooth Terminal”"

i was able to send request to ardunio’ LED to turn ON or OFF

however i was not able to get the heart rate data via bluetooth

and this is the code that i used

---------------------- Notes ---------------------- ----------------------
This code:

  1. Blinks an LED to User’s Live Heartbeat PIN 13
  2. Fades an LED to User’s Live HeartBeat
  3. Determines BPM
  4. Prints All of the Above to Serial

*/
//bluetooth
#include <SoftwareSerial.h>// import the serial library

SoftwareSerial Genotronex(10, 11); // RX, TX
int ledpin=12; // led on D13 will show blink on / off
int BluetoothData; // the data given from Computer

// Variables
int pulsePin = 0; // Pulse Sensor purple wire connected to analog pin 0
int blinkPin = 13; // pin to blink led at each beat
int fadePin = 5; // pin to do fancy classy fading blink at each beat
int fadeRate = 0; // used to fade LED on with PWM on fadePin

// Volatile Variables, used in the interrupt service routine!
volatile int BPM; // int that holds raw Analog in 0. updated every 2mS
volatile int Signal; // holds the incoming raw data
volatile int IBI = 600; // int that holds the time interval between beats! Must be seeded!
volatile boolean Pulse = false; // “True” when User’s live heartbeat is detected. “False” when not a “live beat”.
volatile boolean QS = false; // becomes true when Arduoino finds a beat.

// Regards Serial OutPut – Set This Up to your needs
static boolean serialVisual = true; // Set to ‘false’ by Default. Re-set to ‘true’ to see Arduino Serial Monitor ASCII Visual Pulse

void setup(){
pinMode(blinkPin,OUTPUT); // pin that will blink to your heartbeat!
pinMode(fadePin,OUTPUT); // pin that will fade to your heartbeat!
Serial.begin(115200); // we agree to talk fast!
interruptSetup(); // sets up to read Pulse Sensor signal every 2mS
// UN-COMMENT THE NEXT LINE IF YOU ARE POWERING The Pulse Sensor AT LOW VOLTAGE,
// AND APPLY THAT VOLTAGE TO THE A-REF PIN
// analogReference(EXTERNAL);
Genotronex.begin(9600);
Genotronex.println(“Bluetooth On please press 1 or 0 blink LED …”);
pinMode(ledpin,OUTPUT);
}

// Where the Magic Happens
void loop(){

serialOutput() ;

if (QS == true){ // A Heartbeat Was Found
// BPM and IBI have been Determined
// Quantified Self “QS” true when arduino finds a heartbeat
digitalWrite(blinkPin,HIGH); // Blink LED, we got a beat.
fadeRate = 255; // Makes the LED Fade Effect Happen
// Set ‘fadeRate’ Variable to 255 to fade LED with pulse
serialOutputWhenBeatHappens(); // A Beat Happened, Output that to serial.
QS = false; // reset the Quantified Self flag for next time
}
else {

digitalWrite(blinkPin,LOW); // There is not beat, turn off pin 13 LED
}

ledFadeToBeat(); // Makes the LED Fade Effect Happen
if (Genotronex.available()){
BluetoothData=Genotronex.read();
if(BluetoothData==‘1’){ // if number 1 pressed …
digitalWrite(ledpin,1);
Genotronex.println("LED On D12 ON ! ");
}
if (BluetoothData==‘0’){// if number 0 pressed …
digitalWrite(ledpin,0);
Genotronex.println("LED On D12 Off ! ");
}
}
delay(20); // take a break
}

No surprise in the heading, then. Code is incomplete and does not compile. There at least two undeclared subroutines. There are no serial commands, so why you have to "talk fast!" is unclear.

Well, i changed it to 4200

In the serial Monic , the heart rate data shoes but only give me 200 BPM

I’m new to Arduino and found this code on the web

I understand the most of the code but can’t spot errors

mans89:
I’m new to Arduino and found this code on the web

I understand the most of the code

You clearly don’t. You either failed to post some of it here, or you left it behind on the web.

here is where i found it tho

https://www.instructables.com/id/Pulse-Sensor-With-Bluetooth-and-Arduino/

Read reply #1 again, twice. Then read reply #3. You might also try Googling up some better information. Generally speaking, if you insist on using Instructables, you probably deserve all the grief you get, and there is bound to be something better around - maybe on the manufacturer's website.

Instructables are great for inspiration, not so great to blindly copy. I've gotten great stuff off of them, but only in the cases where I actually understood fully what they were doing.

Instructables are also a known source of wrong and very wrong information, in part because it is not possible to post comments with corrections...

i wish i did not ask

all i have got is grief answers

this is not a good of guiding to good solution with a harsh language and speaking like you know better than anyone else

all i wanted is pointing out to the problem

ok you said serial commend what is that? i have already mentioned that i am just f beginner

Now if you had started off by reading the sticky, you'd have known to post your full code and how to use code tags, give a link to the actual sensor used, give actual results, etc. That'd have saved you a lot of "grief".

Start with the simplest sketch possible: something that reads the heart rate sensor and prints the results to the Serial monitor. No more, no less. Until you can communicate with the sensor correctly there's no use in trying to blink LEDs or calculate a BPM or whatever.

mans89: all i wanted is pointing out to the problem

The problem has been pointed to, and pretty clearly, in reply #1. Your code is incomplete and does not compile.

You call for Serial.begin(115200); and even talk about how important it is to run at that rate, but then you don't use it. So what the hell is that all about?

You might look here, https://pulsesensor.com/pages/code-and-guide as there is a fair chance that these people know what they are doing.

great .

i have got the heartRate BPM but my Bluetooth is still not working.

breaking down the code and the problem is the way to get things solve.

so i know that my 1st code was blinking the LED via bluetooth but this is not the case

i want the rate transfered over the bluetooth into my screen

i actually got new heartRate module today which is max300100 so all i am doing is just testing out. and play around with input/out from ardunio via bluetooth

mans89: i want the rate transfered over the bluetooth into my screen

To do that, you simply connect Bluetooth to the hardware serial pins 0,1 Rx>Tx and Tx>Rx at the appropriate baud rate. This assumes you have already configured HC-06 to the correct rate. If not, see the Martyn Currey website.