Ventilator data to blynk application using ESP8266

Dear All,
I am measuring Sp02 levels and Heart rate on my Arduino using MAX30100 sensor where i wish to send this data to blynk app using esp8266. sending data through to esp module is perfect but i receive continuous zero on value display widget on blynk app! not sure why i have tried many different things which i didn't work

please review my codes and do find the attached serial monitor data of esp module
Code on Arduino

#include "MAX30100_PulseOximeter.h"
#include <SoftwareSerial.h>
#include <Wire.h>
SoftwareSerial atmega_slave(3, 2);
SoftwareSerial nodemcu(13, 12); //  13 to RX and 12 to TX of nodemcu

#define REPORTING_PERIOD_MS     50

PulseOximeter pox;
uint32_t tsLastReport = 0;
int heart_rate;
int spo2;
String v2nodemc;
void onBeatDetected()
{
  Serial.println("Beat!");
}

void setup()
{
  Serial.begin(9600);
  atmega_slave.begin(9600);
  nodemcu.begin(9600);  //
  Serial.print("Initializing pulse oximeter..");

  // Initialize the PulseOximeter instance
  // Failures are generally due to an improper I2C wiring, missing power supply
  // or wrong target chip
  if (!pox.begin()) {
    Serial.println("FAILED");
    //    for (;;);
  } else {
    Serial.println("SUCCESS");
  }
  pox.setIRLedCurrent(MAX30100_LED_CURR_7_6MA);

  // Register a callback for the beat detection
  pox.setOnBeatDetectedCallback(onBeatDetected);
}

void loop()
{
  // Make sure to call update as fast as possible
  pox.update();
  if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
    //        Serial.print("Heart rate:");
    //        Serial.print(pox.getHeartRate());
    //        Serial.print("bpm / SpO2:");
    //        Serial.print(pox.getSpO2());
    //        Serial.println("%");
    heart_rate = pox.getHeartRate();
    Serial.print("Heart rate:");
    Serial.println(heart_rate);
    spo2 = pox.getSpO2();
    if (spo2 > 99)
    {
      spo2 = 99;
    }
    Serial.print("bpm / SpO2:");
    Serial.print(spo2);
    Serial.println("%");
    transmit_parameter();       //send data
    tsLastReport = millis();
  }

}

void transmit_parameter()
{
  String spo2_string, hr_string;
  if (heart_rate <= 0)
  {
    hr_string = String("00");
  }
  else
  {
    hr_string = String(heart_rate);
  }
  if (spo2 <= 0)
  {
    spo2_string = String("00");
  }
  else
  {
    spo2_string = String(spo2);
  }
  atmega_slave.listen();
  atmega_slave.print('*');
  atmega_slave.print(spo2_string);
  atmega_slave.print('#');
  atmega_slave.end();
  nodemcu.listen();  //
  v2nodemc = spo2_string + "," + hr_string;
  nodemcu.println(v2nodemc);
  delay(3000);
  nodemcu.end();
}

Code on esp8266

#define BLYNK_PRINT Serial
#include <BlynkSimpleEsp8266.h>
#include <SoftwareSerial.h>
char auth[] = "1fEa0tzpzw8IIcJA1x3PnSP2GsicMz-6";


char ssid[] = "TP-LINK_FF";
char pass[] = "07379413";


String myString, l, m; 
char rdata; 


int firstVal, secondVal; // sensors

void myTimerEvent()
{
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V1, millis() / 1000);

}
void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
}

void loop()
{
  if (Serial.available() == 0 )
  {
    Blynk.run();
  }
  if (Serial.available() > 0 )
  {
    rdata = Serial.read();
    delay(1000);
    myString = myString + rdata;


    if ( rdata == '\n')
    {
      l = getValue(myString, ',', 0);
      m = getValue(myString, ',', 1);

      firstVal = l.toInt();
      secondVal = m.toInt();
      Blynk.virtualWrite(V2, l);
      Blynk.virtualWrite(V3, m);
      myString = "";

    }
  }
}

String getValue(String data, char separator, int index)
{
  int found = 0;
  int strIndex[] = { 0, -1 };
  int maxIndex = data.length() - 1;

  for (int i = 0; i <= maxIndex && found <= index; i++) {
    if (data.charAt(i) == separator || i == maxIndex) {
      found++;
      strIndex[0] = strIndex[1] + 1;
      strIndex[1] = (i == maxIndex) ? i + 1 : i;
    }
  }
  return found > index ? data.substring(strIndex[0], strIndex[1]) : "";
}

espcom.PNG

espcom.PNG

What made you think that your question has anything to do with the Website and Forum section which is clearly stated to be for "Improvements for the web system, applications to moderator, spam, etc."? I have suggested to the Moderator to move it to the Networking section.

This sort of carelessness makes unnecessary work for the Moderators.

Please read How to get the best out of the Forum

...R

Is this a work project?

@touseefz - your post in the Website and Forum section that just had a link to this one has been deleted

Cross-posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes (or more) writing a detailed answer on this topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting will result in a timeout from the forum.

In the future, please take some time to pick the forum board that best suits the topic of your question and then only post once to that forum board. This is basic forum etiquette, as explained in the sticky "How to use this forum - please read." post you will find at the top of every forum board. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.