Pulse sensor with WeMos D1 board

Hello everybody, i’m working on a pulse sensor and I want to read A0 BPM from it, I tried many codes related to virtual reading on LCD but no results and the configuration is not like what i really need, is there anyone who can help me with it, I have a WeMos D1 board (with esp8266) and I want to send the BPM values to my iPhone blynk app using lcd


Code of pulse using specific simple library:

#define heartPin A0

void setup() {

  Serial.begin(115200);

}

void loop() {

  int heartValue = analogRead(heartPin);

  Serial.println(heartValue);

  delay(1000);

}

Code for simple mode pushing (Blynk library):

#define BLYNK_PRINT Serial

#include <SPI.h>

#include <Ethernet.h>

#include <BlynkSimpleEthernet.h>

// You should get Auth Token in the Blynk App.

// Go to the Project Settings (nut icon).

char auth[] = "YourAuthToken";

BlynkTimer timer;

void sendSeconds() {

  Blynk.virtualWrite(V0, millis() / 1000);

}

void sendMillis() {

  Blynk.virtualWrite(V1, millis());

}

void setup()

{

  // Debug console

  Serial.begin(9600);

  Blynk.begin(auth);

  // Setup a function to be called every second

  timer.setInterval(1000L, sendSeconds);

  // Setup a function to be called every second

  timer.setInterval(1000L, sendMillis);

}

void loop()

{

  Blynk.run();

  timer.run();

}

Did you try looping before dmd execution? I guess that might help. I repeat I guess not sure thou.

Regards,
Smith Plex . https://tutuappx.com/

First off, move the int declaration out of loop, than you need to attach the sensor to a digital Pin not analog (as it’s a pulse output from the sensor) and attach an ISR to that pin (interrupt routine). You will than time the pulses so you’ll be able to “measure” your pulse. I’d start without blynk and printing to serial, when that works, “upgrade” to blynk.

2 Likes