Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pulseSensor.sawStartOfBeat is always false #61

Closed
Tvde1 opened this issue Jun 2, 2018 · 3 comments
Closed

pulseSensor.sawStartOfBeat is always false #61

Tvde1 opened this issue Jun 2, 2018 · 3 comments

Comments

@Tvde1
Copy link

Tvde1 commented Jun 2, 2018

Here is my (short) sketch:

#define USE_ARDUINO_INTERRUPTS false
#include <PulseSensorPlayground.h>

PulseSensorPlayground pulseSensor;

void setup() {
	Serial.begin(115200);

	pulseSensor.analogInput(A0);

	pulseSensor.setSerial(Serial);
	pulseSensor.setOutputTypeSERIAL_PLOTTER);
	pulseSensor.setThreshold(550);

	samplesUntilReport = SAMPLES_PER_SERIAL_SAMPLE;

	if (!pulseSensor.begin()) {
		Serial.println("Cannot begin.");
	}
}

void loop() {
	if (pulseSensor.sawStartOfBeat()) {
		pulseSensor.outputBeat();
	}
}

This will never output anything while previously using pulseSensor.outputSample(); would output valid bpm and a nice heartbeat to the graph.

I tested this with the serial monitor on an ESP8266.

@biomurph
Copy link
Contributor

biomurph commented Jun 3, 2018

Try running the BPM_Alternative example sketch from the Playground.
I'm pretty sure you need to run the sawNewSample() function in order to get the sawStartOfBeat() to work right.

@Tvde1
Copy link
Author

Tvde1 commented Jun 3, 2018

I just put it in there in the loop?

@biomurph
Copy link
Contributor

biomurph commented Jun 4, 2018

First, use the example BPM_Alternative code, and then work from that if you need to make any adjustments.

@biomurph biomurph closed this as completed Jun 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants