Your Arduino went offline

I did a short testin routine to blink an Widget LED.

When connecting and sending a message/email everything works.
But I somehow can’t get the LED working.

As soon as I try a simple blink routine I get disconnected.
I first thought its because I might flood the server but I dont…

First tried with WidgetLED but it didn work so I tried the way I was told should work too.

void loop()
{
  Blynk.run();

  Serial.println("\nSENT\nBlinking now!");

  while (1);
  {
  Blynk.virtualWrite(V18, 255);
  delay(1000);
  Blynk.virtualWrite(V18, 0);
  delay(1000);
  }
}

Also tried:

void loop()
{
  Blynk.run();

  Serial.println("\nSENT\nBlinking now!");

  while (1);
  {
  Blynk.virtualWrite(V18, 255);
  delay(1000);
  Blynk.run();
  Blynk.virtualWrite(V18, 0);
  delay(1000);
  Blynk.run();
  }
}

Those code is wrong. Please have a look on few working LED examples - https://github.com/blynkkk/blynk-library/tree/master/examples/Widgets/LED

1 Like

As I said as in the example is the way I tried first and didn’t work.
So you can’t Virtualwrite to a led at all?

You can. Please show us code that didn’t work (those one above will not work for sure). Also please try this.

1 Like

WidgetLED led1(V18);

In Loop after connecting:

  while (1);
  {
    led1.off();
    Serial.println("LED off");
    delay(500);
    led1.on();
    Serial.println("LED on");
    delay(500);
  }

This doesn’t work either.
I tried to avoid timer library for testing.

Also to simplify I didn’t check for status since it should then change to the correct status 500ms later.

So do I need to REALLY check for status or cant it work without the timer library?

Maybe I need to insert Blynk run in the above? Will try

But I would rather like to use a simple virtualwrite than this Widgetled.

How to do it with virtualwrite?

  while (1);
  {
    led1.off();
    Serial.println("LED off");
    delay(500);
    Blynk.run();
    led1.on();
    Serial.println("LED on");
    delay(500);
    Blynk.run();
  }

Doesn’t work either

@Gorkde please try example we provide with blynk library. Check if it works. There no sense to try something else even basic sketch doesn’t work for you.

1 Like

Ok, now found the Line in the example that helped a bit… Didn’t know about BLYNK_PRINT.
Now I can see it’s a buffer overflow but I dont know why.

Marked the Lines I added/Removed since I use ESP8266 for connection:

/**************************************************************
 * Blynk is a platform with iOS and Android apps to control
 * Arduino, Raspberry Pi and the likes over the Internet.
 * You can easily build graphic interfaces for all your
 * projects by simply dragging and dropping widgets.
 *
 *   Downloads, docs, tutorials: http://www.blynk.cc
 *   Blynk community:            http://community.blynk.cc
 *   Social networks:            http://www.fb.com/blynkapp
 *                               http://twitter.com/blynk_app
 *
 * Blynk library is licensed under MIT license
 * This example code is in public domain.
 *
 **************************************************************
 * Blynk using a LED widget on your phone!
 *
 * App project setup:
 *   LED widget on V1
 *
 * WARNING :
 * For this example you'll need SimpleTimer library:
 *   https://github.com/jfturcot/SimpleTimer
 * Visit this page for more information:
 *   http://playground.arduino.cc/Code/SimpleTimer
 *
 **************************************************************/

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
// #include <SPI.h>                                             // ***** REMOVED (Don't use Ethernet Shield) *****
// #include <Ethernet.h>                                        // ***** REMOVED (Don't use Ethernet Shield) *****
// #include <BlynkSimpleEthernet.h>                             // ***** REMOVED (Don't use Ethernet Shield) *****
#include <SimpleTimer.h>
#include <ESP8266_HardSer.h>                                    // ***** ADDED *****
#include <BlynkSimpleShieldEsp8266_HardSer.h>                   // ***** ADDED *****

#define EspSerial Serial                                        // ***** ADDED *****
ESP8266 wifi(EspSerial);                                        // ***** ADDED *****
char WLANname[] = "*******";                              // ***** ADDED *****
char WLANpw[] = "*******";                                     // ***** ADDED *****


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

WidgetLED led1(V1);

SimpleTimer timer;

void setup()
{
  Serial.begin(115200);                                          // ***** ADDED *****
  delay(10);                                                     // ***** ADDED *****
  Serial.println();                                              // ***** ADDED *****  


  // Verbindungsaufbau WLAN                                      // ***** ADDED *****
  Serial.println("\n\rBaue Verbindung auf...\n");                // ***** ADDED *****
  Blynk.begin(auth, wifi, WLANname, WLANpw);                     // ***** ADDED *****
  delay(10);                    // ***** ADDED *****
  while (Blynk.connect() == false) {                             // ***** ADDED *****
  }                                                              // ***** ADDED *****

  Serial.println("Starte Ueberwachung...\n");                    // ***** ADDED *****

  timer.setInterval(1000L, blinkLedWidget);
}

// V1 LED Widget is blinking
void blinkLedWidget()
{
  if (led1.getValue()) {
    led1.off();
    Serial.println("LED on V1: off");
  } else {
    led1.on();
    Serial.println("LED on V1: on");
  }
}

void loop()
{
  Blynk.run();
  timer.run();
}

Sometimes I get Overflow even before the LED routine even starts…

For some Reason I cant copy and paste the serial Monitor output, it always stops copying after 2 lines probably because of some control Chars.

Any Idea how I might copy to post it here?

1 Like

Need to go for a dogwalk, till later!

BTW… Thanks for your great and quick support!

Your title is Arduino went offline while you are using ESP… So what exactly are you have?

As said the App sends notification the Arduino goes offline.

When testing the sketch above it connects then for some reason gets buffer overflow I saw now with the print function.

And the LED-Widget NEVER EVER changed / blinked!

I cant copy the Serial Monitor output to show you. Any Idea on how to copy it?

Did some Screenshoots, maybe that helps

Ok, now the LED changed state once, then disconnect happened.

1 Like

What is your hardware? What is your wiring?

@gorkde you are using old Blynk libraries, try using the latest ones.

You seem to have numerous libraries for hardware you are probably not using.

Describe what hardware you are using and then use the relevant libraries shown in the examples e.g. Ethernet, ESP as shield, ESP standalone.

Ensure your project has the correct hardware setting.

I got a chinese Uno with CHG340 Serial Chip, that works very well in other sketches and I connected an esp8266 to external 3,3V Volt (voltage regulator) and RX/TX of the arduino (the Rx over voltage divider resistors)

Like in this post:

1 Like

ok found the reason!

Works now!

I had some cables at the ESP that I didnt use in this setup which probably were catching some radio.
I shortened them and now it works.

So back to my original Question can I set the led with Virtualwrite?
Or only this way?

in the other Thread you said:

3) You need either use WidgeLED or Blynk.virtualWrite(V18, 255); // HIGH. See http://docs.blynk.cc/#widgets-displays-led for more info;

But that doesnt work, just tested

void blinkLedWidget()
{
  if (led1.getValue()) {
    Blynk.virtualWrite(V18, 0);
    Serial.println("\nLED on V18: off");
  } else {
    Blynk.virtualWrite(V18, 255);
    Serial.println("\nLED on V18: on");
  }
}

ah ok, got it… the getvalue isnt from the app…

Solved my problem
Thanks for your help!

OMG!

Nothing changed now I get the buffer overflow again…

AT+CIPSEND=14
+vw 18 255
[80319] Buffer overflow
[80319] Buffer overflow
[80320] Buffer overflow
[80321] Buffer overflow
[80322] Buffer overflow
[80324] Buffer overflow
[80326] Buffer overflow
[80328] Buffer overflow
[80330] Buffer overflow
[80332] Buffer overflow