WorldFamousElectronics / PulseSensorPlayground

A PulseSensor library (for Arduino) that collects our most popular projects in one place.
https://PulseSensor.com
MIT License
200 stars 97 forks source link

Is there a way to simply get a numeric BPM #29

Closed SparkMike77 closed 6 years ago

SparkMike77 commented 6 years ago

I'm looking for how to just pull the BPM number, not plot it on a graph but all the BPM sketches have a graphing output.

I'm assuming instead of calling pulseSensor.outputBeat() there's a way just to call for the numeric BPM?

joelSensor commented 6 years ago

There is a way to just get BPM number. Please check out the PulseSensor Playground Tools https://github.com/WorldFamousElectronics/PulseSensorPlayground/blob/master/resources/PulseSenaor%20Playground%20Tools.md

a call to getBeatsPerMinute() will return the latest BPM value (int). You can simply comment out the call to pulseSensor.outputBeat() and just do you own thing instead.

yury-g commented 6 years ago

SparkMike77, I drafted some code here for you. It's not pretty, but it does the behavior you requested. Try this code in a new Sketch, or just run it as an ".ino" file in Arduino. https://github.com/yury-g/ReadMePlayground/blob/master/PulseSensor_BPM_Serial_Print.ino

This is a screengrab of it working correctly: Let me know if it helps!

pulsesensor_bpm_code_screengrab
yury-g commented 6 years ago

Mike, Try the sketch at this link. It is BPM and BPM-only via our new Library. ; )

https://github.com/WorldFamousElectronics/PulseSensorPlayground/blob/master/examples/Getting_BPM_to_Monitor/Getting_BPM_to_Monitor

SparkMike77 commented 6 years ago

Thanks Guys, I had completely forgotten to check back and was hammering on my own library (really poorly). This looks exactly like what I need!

haarers commented 6 years ago

Is there somewhere that I can see the code for the function

getBeatsPerMinute()

Thanks!

biomurph commented 6 years ago

The actual function is pretty simple, and it's on line 87 here https://github.com/WorldFamousElectronics/PulseSensorPlayground/blob/master/src/utility/PulseSensor.cpp

The function that determines BPM is called processLatestSample, on line 122 of the same file.

haarers commented 6 years ago

Thank you, Joel. I appreciate this. -Shawn Haarer

On Wed, Jul 18, 2018 at 10:46 AM, Joel Murphy notifications@github.com wrote:

The actual function is pretty simple, and it's on line 87 here https://github.com/WorldFamousElectronics/PulseSensorPlayground/blob/ master/src/utility/PulseSensor.cpp

The function that determines BPM is called processLatestSample, on line 122 of the same file.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/WorldFamousElectronics/PulseSensorPlayground/issues/29#issuecomment-405978980, or mute the thread https://github.com/notifications/unsubscribe-auth/Ak6kbCR5Q7ZAbQcx6sADxHgspVH9OPlhks5uH1hzgaJpZM4RKrmC .