Skip to content

Commit

Permalink
Merge pull request #2 from WorldFamousElectronics/master
Browse files Browse the repository at this point in the history
updating to current WFE version
  • Loading branch information
biomurph committed Jan 18, 2018
2 parents 1465e11 + 3ed1dd9 commit 9caef11
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 38 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
@@ -0,0 +1,5 @@
examples/ linguist-documentation=false
*.ino linguist-language=Arduino
*.cpp linguist-language=Arduino
*.hpp linguist-language=Arduino
*.h linguist-language=Arduino
94 changes: 61 additions & 33 deletions README.md
Expand Up @@ -2,44 +2,59 @@
![logo](https://avatars0.githubusercontent.com/u/7002937?v=3&s=200)
# [PulseSensor.com](https://pulsesensor.com) Playground
```
This Playground is a collection of code of the most popular uses of PulseSensor and Arduino.
This Playground is a collection of code for the most popular uses of PulseSensor and Arduino.
- The playgroud includes a number of projects, with the code already written-out and commented! 🤘 
- Use this code to get started quickly, or do advanced stuff. 👍
- Switch between projects right in the Arduino IDE (software). 💻
- Contritube your projects code back to the GitHub hive-mind. 🐝
```

---
## Installing the Pulse Sensor Playground 🤓 
1. On the main page of this repository, on the right side is a green button. Click on the green `Clone or Download ZIP` button and then select `Download ZIP`. Save the `.zip` file somewhere on your computer.
## Install the PulseSensor Playground Library !
<details><summary><code>How To Install: </code> 🤓</summary>

<img src="https://cdn.shopify.com/s/files/1/0100/6632/files/Download_Playground_ZIP_1024x1024.png?v=1510864702" width="400">
An Arduino Library is a collection of code and examples on a specific topic or device. For example, our PulseSensor Playground Library is a collection of code and projects made just for your PulseSensor and Arduino.

2. Open up the Arduino IDE.
(**NOTE** If you do not have Arduino, you can download it [here](https://www.arduino.cc/en/Main/Software))

(**NOTE** If you do not have Arduino, you can download it [here](https://www.arduino.cc/en/Main/Software))
To install the PulseSensor Playground Library, in Arduino, to go
`Sketch > Include Library > Manage Library...`

3. Select `Sketch > Include Library > Add .ZIP Library...`
<img src="https://github.com/yury-g/MyCodePlayground/blob/master/images/ManageLibraries.png" width="550">

<img src="https://cdn.shopify.com/s/files/1/0100/6632/files/Add_ZIP_LIbrary_1024x1024.png?v=1510865023" width="400">

In the Library Manager: Search for and Select
`"PulseSensor.com`

5. Navigate to the location where you downloded the `.zip` file previously and select it to install this library. (**NOTE** you may need to restart Arduino after this step)
6. Hurray! Once this library is installed you will see our examples in Arduino's dropdown! To select an example sketch, go to
<img src="https://github.com/yury-g/MyCodePlayground/blob/master/images/SearchForPulseSensor.png" width="550">


Install or update to the lastest version.👍

`File > Examples > PulseSensor Playground`
<img src="https://github.com/yury-g/MyCodePlayground/blob/master/images/InstallLatestVersion.png" width="550">

Go to [PulseSensor.com](https://pulsesensor.com/) and click on the PROJECTS link to find tutorials that go with these code examples!

---
## PulseSensor Playground Tools
Hurray! Once this library is installed you will see our examples in Arduino's dropdown!
To select an example project, go to:
`File > Examples > PulseSensor Playground > GettingStartedProject`
<img src="https://github.com/yury-g/MyCodePlayground/blob/master/images/ExamplesPlaygroundGettingStartedMenuPullDown.png" width="550">

We put together a [HANDY GUIDE](https://github.com/biomurph/PulseSensorPlayground/blob/master/resources/PulseSenaor%20Playground%20Tools.md) to the function-ality of our library. Check it out if you want to dive into the inner workings!




More Info On Libraries in General 👉 [https://www.arduino.cc/en/Guide/Libraries](https://www.arduino.cc/en/Guide/Libraries).


</div>
</details>

---
## Playground Project Descriptions:


### Start Here:
### Getting Started Project:  
Plug your sensor in for the first time! Blink an LED with your pulse, live.

- [**Project Page**](https://pulsesensor.com/pages/code-and-guide)
Expand Down Expand Up @@ -71,7 +86,6 @@ We put together a [HANDY GUIDE](https://github.com/biomurph/PulseSensorPlaygroun

<img src="https://cdn.shopify.com/s/files/1/0100/6632/files/PulseSensor_Servo_bb_87fce9fc-dc47-4208-b708-a7edb6df58a2_1024x1024.png?v=1510863990" width="400">
---


### Processing Visualizer:

Expand All @@ -80,36 +94,50 @@ We put together a [HANDY GUIDE](https://github.com/biomurph/PulseSensorPlaygroun
- [**Project Page**](https://pulsesensor.com/pages/getting-advanced)

<img src="https://cdn.shopify.com/s/files/1/0100/6632/files/ScreenShot_1024x1024.png?v=1491857113" width="400">
---

### TroubleShoot Your Signal:
---

## Connecting the Harware 😎
1. Prepare the sensor, with the Kit parts.

<img src="https://cdn.shopify.com/s/files/1/0100/6632/products/PulseSensorKit-Labeled-Contents_1_2048x2048.jpg?v=1348506345" width="400">

2. See the recommended wiring for your specific project

<img src="https://github.com/WorldFamousElectronics/PulseSensorStarterProject/blob/master/connections.png" width="400">
<img src="https://github.com/WorldFamousElectronics/PulseSensorStarterProject/raw/master/Arduino-LEDonPin13-PulseSensor-Pic.jpg" width="400">

---

## The Functions Guide

We put together a [HANDY GUIDE](https://github.com/biomurph/PulseSensorPlayground/blob/master/resources/PulseSenaor%20Playground%20Tools.md) to the function-ality of our library. Check it out if you want to dive into the inner workings!

---

## Troubleshooting Your Signal:

<details><summary><code> Ugh, Where's the Beat ? </code>😵</summary>
If you're having trouble seeing a heartbeat, make sure that you are using 'Goldilocks' pressure on the Pulse Sensor: Not too hard, not too soft. Squeezing the Pulse Sensor too hard against your skin will make the heartbeat go away, and not enough pressure will cause too much noise to creep in!

If you are seeing way too many Beats Per Minute, or you are getting lots of noise, try adjusting the Threshold setting. The Threshold variable tells Arduino when to find a pulse that is legit. Adjust this number (noted below with arrows) up for less sensitivity and down for more sensitivity. In the [**StarterProject**](https://pulsesensor.com/pages/code-and-guide) you can find the Threshold variable as shown in the pic below:

![StarterThreshold](https://github.com/biomurph/PulseSensorPlayground/blob/master/Images/screenshot-threshold-arrows.png)

In the other examples, the `THRESHOLD` is defined at the top of the code.

</div>
</details>

---
## Connecting the Harware 😎
1. Prepare the sensor, with the Kit parts.

<img src="https://cdn.shopify.com/s/files/1/0100/6632/products/PulseSensorKit-Labeled-Contents_1_2048x2048.jpg?v=1348506345" width="400"><img src="https://github.com/WorldFamousElectronics/PulseSensorStarterProject/raw/master/Arduino-LEDonPin13-PulseSensor-Pic.jpg" width="400">

2. See the recommended wiring for your specific project

<img src="https://github.com/WorldFamousElectronics/PulseSensorStarterProject/blob/master/connections.png" width="400">

---
## Give and Get Feedback
The [Issues Tab](https://github.com/WorldFamousElectronics/PulseSensorStarterProject/issues
) will get you the quickest answers to common techinal questions.
The [Issues Tab](https://github.com/WorldFamousElectronics/PulseSensorStarterProject/issues) will get you the quickest answers to common techinal questions.


---
##### Legal: PulseSensor.com® World Famous Electronics llc. in Brooklyn, NY. USA
Made Something Awesome With the PulseSensor Code? Send Us Some PayPal Love. ♥︎
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg?style=plastic)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KE4DZA5E9AJQ4)

#### Legal: PulseSensor.com® World Famous Electronics llc. in Brooklyn, NY. USA



57 changes: 57 additions & 0 deletions examples/Getting_BPM_to_Monitor/Getting_BPM_to_Monitor.ino
@@ -0,0 +1,57 @@

/* Getting_BPM_to_Monitor prints the BPM to the Serial Monitor, using the least lines of code and PulseSensor Library.
* Tutorial Webpage: https://pulsesensor.com/pages/getting-advanced
*
--------Use This Sketch To------------------------------------------
1) Displays user's live and changing BPM, Beats Per Minute, in Arduino's native Serial Monitor.
2) Print: "♥ A HeartBeat Happened !" when a beat is detected, live.
2) Learn about using a PulseSensor Library "Object".
4) Blinks LED on PIN 13 with user's Heartbeat.
--------------------------------------------------------------------*/

#define USE_ARDUINO_INTERRUPTS true // Set-up low-level interrupts for most acurate BPM math.
#include <PulseSensorPlayground.h> // Includes the PulseSensorPlayground Library.

// Variables
const int PulseWire = 0; // PulseSensor PURPLE WIRE connected to ANALOG PIN 0
const int LED13 = 13; // The on-board Arduino LED, close to PIN 13.
int Threshold = 550; // Determine which Signal to "count as a beat" and which to ignore.
// Use the "Gettting Started Project" to fine-tune Threshold Value beyond default setting.
// Otherwise leave the default "550" value.

PulseSensorPlayground pulseSensor; // Creates an instance of the PulseSensorPlayground object called "pulseSensor"


void setup() {

Serial.begin(9600); // For Serial Monitor

// Configure the PulseSensor object, by assigning our variables to it.
pulseSensor.analogInput(PulseWire);
pulseSensor.blinkOnPulse(LED13); //auto-magically blink Arduino's LED with heartbeat.
pulseSensor.setThreshold(Threshold);

// Double-check the "pulseSensor" object was created and "began" seeing a signal.
if (pulseSensor.begin()) {
Serial.println("We created a pulseSensor Object !"); //This prints one time at Arduino power-up, or on Arduino reset.
}
}



void loop() {

int myBPM = pulseSensor.getBeatsPerMinute(); // Calls function on our pulseSensor object that returns BPM as an "int".
// "myBPM" hold this BPM value now.

if (pulseSensor.sawStartOfBeat()) { // Constantly test to see if "a beat happened".
Serial.println("♥ A HeartBeat Happened ! "); // If test is "true", print a message "a heartbeat happened".
Serial.print("BPM: "); // Print phrase "BPM: "
Serial.println(myBPM); // Print the value inside of myBPM.
}

delay(20); // considered best practice in a simple sketch.

}


2 changes: 1 addition & 1 deletion keywords.txt
Expand Up @@ -26,7 +26,7 @@ sawNewSample KEYWORD2
setSerial KEYWORD2
setOutputType KEYWORD2
sawStartOfBeat KEYWORD2
setThreshold KEYWORD2
setThreshold KEYWORD2

#######################################
# Instances (KEYWORD2)
Expand Down
8 changes: 4 additions & 4 deletions library.properties
@@ -1,9 +1,9 @@
name=PulseSensor Playground
version=1.1.1
version=1.2.3
author=Joel Murphy, Yury Gitman, Brad Needham
maintainer=Joel Murphy
sentence=Support for PulseSensor hardware available at https://pulsesensor.com
paragraph=Use the examples here to get started with the PulseSensor.
maintainer=Joel Murphy, Yury Gitman
sentence=Support at PulseSensor.com
paragraph=Code and Examples for PulseSensor from PulseSensor.com
category=Other
url=https://github.com/WorldFamousElectronics/PulseSensorPlayground
architectures=*
File renamed without changes.

0 comments on commit 9caef11

Please sign in to comment.