Skip to content

Commit 6f3b87b

Browse files
committed
changes made to pulse sensor folder name
1 parent face5e4 commit 6f3b87b

File tree

4 files changed

+59
-0
lines changed

4 files changed

+59
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
2+
/* Getting_BPM_to_Monitor prints the BPM to the Serial Monitor, using the least lines of code and PulseSensor Library.
3+
* Tutorial Webpage: https://pulsesensor.com/pages/getting-advanced
4+
*
5+
--------Use This Sketch To------------------------------------------
6+
1) Displays user's live and changing BPM, Beats Per Minute, in Arduino's native Serial Monitor.
7+
2) Print: "♥ A HeartBeat Happened !" when a beat is detected, live.
8+
2) Learn about using a PulseSensor Library "Object".
9+
4) Blinks LED on PIN 13 with user's Heartbeat.
10+
--------------------------------------------------------------------*/
11+
12+
#define USE_ARDUINO_INTERRUPTS true // Set-up low-level interrupts for most acurate BPM math.
13+
#include <PulseSensorPlayground.h> // Includes the PulseSensorPlayground Library.
14+
15+
// Variables
16+
const int PulseWire = 0; // PulseSensor PURPLE WIRE connected to ANALOG PIN 0
17+
const int LED13 = 13; // The on-board Arduino LED, close to PIN 13.
18+
int Threshold = 550; // Determine which Signal to "count as a beat" and which to ignore.
19+
// Use the "Gettting Started Project" to fine-tune Threshold Value beyond default setting.
20+
// Otherwise leave the default "550" value.
21+
22+
PulseSensorPlayground pulseSensor; // Creates an instance of the PulseSensorPlayground object called "pulseSensor"
23+
24+
25+
void setup() {
26+
27+
Serial.begin(9600); // For Serial Monitor
28+
29+
// Configure the PulseSensor object, by assigning our variables to it.
30+
pulseSensor.analogInput(PulseWire);
31+
pulseSensor.blinkOnPulse(LED13); //auto-magically blink Arduino's LED with heartbeat.
32+
pulseSensor.setThreshold(Threshold);
33+
34+
// Double-check the "pulseSensor" object was created and "began" seeing a signal.
35+
if (pulseSensor.begin()) {
36+
Serial.println("We created a pulseSensor Object !"); //This prints one time at Arduino power-up, or on Arduino reset.
37+
}
38+
}
39+
40+
41+
42+
void loop() {
43+
44+
int myBPM = pulseSensor.getBeatsPerMinute(); // Calls function on our pulseSensor object that returns BPM as an "int".
45+
// "myBPM" hold this BPM value now.
46+
47+
if (pulseSensor.sawStartOfBeat()) { // Constantly test to see if "a beat happened".
48+
Serial.println("♥ A HeartBeat Happened ! "); // If test is "true", print a message "a heartbeat happened".
49+
Serial.print("BPM: "); // Print phrase "BPM: "
50+
Serial.println(myBPM); // Print the value inside of myBPM.
51+
}
52+
53+
delay(20); // considered best practice in a simple sketch.
54+
55+
}
56+
57+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[Picasa]
2+
name=images
Loading
Loading

0 commit comments

Comments
 (0)