#define heartratePin D2
#include "DFRobot_Heartrate.h"
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>   //including the library of SimpleTimer
//int cal;

DFRobot_Heartrate heartrate(DIGITAL_MODE);

SimpleTimer timer;
char auth[] = " 0939204a972c488085a3785cfee2182e";            // You should get Auth Token in the Blynk App.
                                           // Go to the Project Settings (nut icon).

char ssid[] = "88888";    // Your WiFi credentials.
char pass[] = "88888";  // Set password to "" for open networks.

void setup() {
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  timer.setInterval(10, sendUptime);

}

void sendUptime()
{

  uint8_t rateValue;
  heartrate.getValue(heartratePin); ///< A1 foot sampled values
  rateValue = heartrate.getRate(); ///< Get heart rate value
  if(rateValue)  {
    int cal=rateValue/2.10;
    Serial.println(cal);
    Blynk.virtualWrite(V0,cal);
  }
  int sensorValue = analogRead(A0);
  // print out the value you read:
  Serial.println(sensorValue);
  int temp=sensorValue/4;
  Blynk.virtualWrite(V1,temp);
  delay(30);

}
void loop() {

  Blynk.run();
  timer.run();

}

Download library Click Here

No comments

Theme images by Dizzo. Powered by Blogger.