#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX
#define BLYNK_PRINT DebugSerial
#include <BlynkSimpleStream.h>
char auth[] = "35e818fe8eeb4f819c5110654ccbxxxxa";
#include <SPI.h>
#include <Wire.h>
//pulsesense
// Variables
int pulsePin = 0; // Pulse Sensor purple wire connected to analog pin 0
// int blinkPin = 13; // pin to blink led at each beat
int fadePin = 5; // pin to do fancy classy fading blink at each beat
int fadeRate = 0; // used to fade LED on with PWM on fadePin
// Volatile Variables, used in the interrupt service routine!
volatile int BPM; // int that holds raw Analog in 0. updated every 2mS
volatile int Signal; // holds the incoming raw data
volatile int IBI = 600; // int that holds the time interval between beats! Must be seeded!
volatile boolean Pulse = false; // "True" when User's live heartbeat is detected. "False" when not a "live beat".
volatile boolean QS = false; // becomes true when Arduoino finds a beat.
// Regards Serial OutPut -- Set This Up to your needs
static boolean serialVisual = true; // Set to 'false' by Default. Re-set to 'true' to see Arduino Serial Monitor ASCII Visual Pulse
void setup()
{
// Debug console
DebugSerial.begin(9600);
Serial.begin(9600);
Blynk.begin(auth, Serial);
// pinMode(blinkPin,OUTPUT);
pinMode(fadePin,OUTPUT);
// Serial.begin(9600);
interruptSetup();
//pulse sense//
serialOutput() ;
if (QS == true){
fadeRate = 255;
serialOutputWhenBeatHappens(); // A Beat Happened, Output that to serial.
QS = false;
}
ledFadeToBeat(); // Makes the LED Fade Effect Happen
delay(20); // take a break
//Pulsesense End//
}
void ledFadeToBeat(){
fadeRate -= 15;
fadeRate = constrain(fadeRate,0,255);
analogWrite(fadePin,fadeRate);
}
Could you please do this? Makes it really easier to read your code