0% found this document useful (0 votes)
11 views2 pages

Sensor Pul So

The code defines constants for a pulse sensor, LED pins, and a threshold value. It initializes the pulse sensor to read from an analog pin, blink an LED on pulses, and set the threshold. In the loop, it gets the BPM from the sensor, prints it if a beat is detected, and plays a tone and turns on an LED if the BPM is outside a range.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

Sensor Pul So

The code defines constants for a pulse sensor, LED pins, and a threshold value. It initializes the pulse sensor to read from an analog pin, blink an LED on pulses, and set the threshold. In the loop, it gets the BPM from the sensor, prints it if a beat is detected, and plays a tone and turns on an LED if the BPM is outside a range.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

CODIGO:

#define NOTE_B5 988

#define USE_ARDUINO_INTERRUPTS true

#include <PulseSensorPlayground.h>

const int PulseWire = A1;

const int LEDV = 13;

const int LEDR=10;

int Threshold = 550;

PulseSensorPlayground pulseSensor;

void setup() {

Serial.begin(9600);
pinMode(LEDR,OUTPUT);

pulseSensor.analogInput(PulseWire);

pulseSensor.blinkOnPulse(LEDV);

pulseSensor.setThreshold(Threshold);

pulseSensor.begin();

void loop() {

int myBPM = pulseSensor.getBeatsPerMinute();

if (pulseSensor.sawStartOfBeat()) {

Serial.print("BPM: ");

Serial.println(myBPM);

if(myBPM<60||myBPM>90){

digitalWrite(LEDR,HIGH);

tone(11,NOTE_B5,20);

}else{

digitalWrite(LEDR,LOW);

delay(20);

You might also like