[SOLVED] How to code Arduino IDE make ESP8266 indicator connected to server by using LED as indicator?

Hello, I Use NodeMCU ESP8266 try to make project with Arduino IDE.I want make ESP8266 indicator connected to server by using LED as indicator.
How to code Arduino IDE make ESP8266 indicator connected to server by using LED as indicator,
if connected LED is on,
otherwise LED is blinking.

Please Help me…:joy:

Start by posting what you think is the closest existing sketch provided by Blynk that meets your needs.

This will involve at least a glance at each of the many sketches.

@Aldwin Also check out all the Help Center documents (links also at the top right of this page)… they are there to help you learn how to use Blynk… e.g.

Hello, @Gunner i’ve learned, but i want to make is how to make indicator in ESP8266 (built_led / d4) can be an indicator if it is connected with blynk server. So when connected blynk server (builtin_led / d4) = low, and when not connected blynk server (biltin_led / d4) blinks 1sec. If i made it on serial monitor for connected indicator already i can, i add digitalwrite (led, low) led not on. Please help me

@Aldwin study PUSH_DATA example to achieve your 1s intervals. Then if you are still struggling post your bad sketch. Also read “Connection Management” posts in the docs and on this site (by most recent post).

Well, I think what you are looking for will require some of the Connection Management commands… particularly the boolean logic of the Blynk.connected() command.

Perhaps something like this (untested as I am still learning these connection management commands myself ;))…

void loop()
  if (Blynk.connected()) {   // to ensure that Blynk.run() function is only called if we are still connected to the server
  } else {
    // flash disconnected led routine


This is my sketch with Wemos.
if connected LED is fade in fade out
if not connected LED stop fading.

  Download latest Blynk library here:

  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
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Follow us:                  http://www.fb.com/blynkapp

  Blynk library is licensed under MIT license
  This example code is in public domain.


  You’ll need:
   - Blynk App (download from AppStore or Google Play)
   - ESP8266 board
   - Decide how to connect to Blynk
     (USB, Ethernet, Wi-Fi, Bluetooth, ...)

  There is a bunch of great example sketches included to show you how to get
  started. Think of them as LEGO bricks  and combine them as you wish.
  For example, take the Ethernet Shield sketch and combine it with the
  Servo example, or choose a USB sketch and add a code from SendData

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

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

const byte pwmLED = LED_BUILTIN;
// define directions for LED fade
#define UP 0
#define DOWN 1
// constants for min and max PWM
const int minPWM = 0;
const int maxPWM = 1024;
// State Variable for Fade Direction
byte fadeDirection = UP;
// Global Fade Value
// but be bigger than byte and signed, for rollover
int fadeValue = 0;
// How smooth to fade?
byte fadeIncrement = 5;
// millis() timing Variable, just for fading
unsigned long previousFadeMillis;
// How fast to increment?
int fadeInterval = 10;

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

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

void setup()
  // Debug console

  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
  analogWrite(pwmLED, fadeValue);

void doTheFade(unsigned long thisMillis) {
  // is it time to update yet?
  // if not, nothing happens
  if (thisMillis - previousFadeMillis >= fadeInterval) {
    // yup, it's time!
    if (fadeDirection == UP) {
      fadeValue = fadeValue + fadeIncrement;  
      if (fadeValue >= maxPWM) {
        // At max, limit and change direction
        fadeValue = maxPWM;
        fadeDirection = DOWN;
    } else {
      //if we aren't going up, we're going down
      fadeValue = fadeValue - fadeIncrement;
      if (fadeValue <= minPWM) {
        // At min, limit and change direction
        fadeValue = minPWM;
        fadeDirection = UP;
    // Only need to update when it changes
    analogWrite(pwmLED, fadeValue);  
    // reset millis for the next iteration (fade timer only)
    previousFadeMillis = thisMillis;

void loop()
  // You can inject your own code or combine it with other sketches.
  // Check other examples on how to communicate with Blynk. Remember
  // to avoid delay() function!
  unsigned long currentMillis = millis();