Was not onliine yet error and use of Sparkfun ECG sensor, AD8232

Hello guys,

I need help with my project. I leave below my ino code. Teho a problem in syncing with APP, when I start the project in APP it returns me Was not onliine yet. Another problem is that in the IDE’s serial plotter it does not receive data from port A0. I’m trying to read signals from an ECG sensor from Sparkfun, AD8232.

#define BLYNK_PRINT Serial
#define BLYNK_DEBUG

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

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

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

void setup()
{
  // Debug console
  Serial.begin(9600);
  
  Blynk.begin(auth,ssid,pass, IPAddress(192,168,1,9),8080);

  pinMode(5, INPUT); // Setup for leads off detection LO +
  pinMode(4, INPUT); // Setup for leads off detection LO -
 
}

void loop()
{
  Blynk.run();
  if((digitalRead(5) == 1)||(digitalRead(4) == 1)){
    Serial.println('!');
  }
  else{
    // send the value of analog input 0:
      Serial.println(analogRead(A0));
  }
  //Wait for a bit to keep serial data from saturating
  //delay(1);
}

As per the Welcome Topic… Please remember to properly format any code you post here…

Blynk%20-%20FTFC

Please read this about recommended use of the void loop() with Blynk…

http://help.blynk.cc/getting-started-library-auth-token-code-examples/blynk-basics/keep-your-void-loop-clean

And you didn’t mention if you are using a Local Server or the Cloud… your code is configured to a Local Server. Is this you code or copied from some example? If yours, are you sure your server is online? Is the App set to connect to the same server?

Blynk.begin() is a blocking command. That means there is no further code processing done until it connects to the server… thus no sensor reading.

Fix the connection and how you read the data (use a timed function, not in the main loop) and you should see some results.

1 Like