Good day! I am trying to make an online heart monitor using node mcu.
I am trying to make my pulse sensor work, but I don't know if it's working fine.
I found a same project here: .: NodeMCU ESP8266 12E WIFI Monitoring Heart Beat dan Suhu LM35 WEBSERVER
I am able to see values ranging from 400+ ~ 500+ but less than 600
Now, after connecting to the given ip address. The result was
BPM = 18
or
BPM = 24
Here's the code part for the pulse sensor:
bpm = analogRead(AnalogIn);
Serial.print("bpm = ");
Serial.println(bpm);
if((bpm > 600)&&(x > 1)){
x = 0;
bpmx = bpmx + 1;
}
else if((bpm < 600)&&(x < 1)){
x = 2;
}
Now from that code, I am thinking that the "600" is the threshold. Am I correct?
I think this is why i only have 18 bpm.
I am not quite sure about how this code works, why does he have to set x into 2?