ESP 8266 12E device offline

Sorry but I had debugged with “// # include <Blynk.h>” and did not make a mistake.
Here’s the sketch. The only things I changed is the data from my network and Blink

/* From http://www.instructables.com/id/ESP8266-ESP-12Standalone-Blynk-101/?ALLSTEPS
 *  This sketch demonstrates how to scan WiFi networks. 
 *  The API is almost the same as with the WiFi Shield library, 
 *  the most obvious difference being the different file you need to include:
 */
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <Blynk.h>
//#include <BlynkESP8266_Lib.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "Blynk";

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth, "Rede", "Password");

}

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

Now I can not debug because it gives error: " Blynk was not declared in this scope"
What is wrong?

As you have a nodeMCU comment out this line:

#include <Blynk.h>

Your problems are because you are not using the official sketches for your hardware.

For Nodemcu i use this sketch and working fine for me.

/**************************************************************
 * 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.
 *
 **************************************************************
 * This example runs directly on ESP8266 chip.
 *
 * Note: This requires ESP8266 support package:
 *   https://github.com/esp8266/Arduino
 *
 * Please be sure to select the right ESP8266 module
 * in the Tools -> Board menu!
 *
 * Change WiFi ssid, pass, and Blynk auth token to run :)
 *
 **************************************************************/

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

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

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

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

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

It worked !!! :grinning::musical_note::notes:
At the first time´

I’ll have to understand this. It seems impossible as something that seems so easy became so complicated.

Now I will compare the two and see what is wrong.
At first glance they look the same. I will study them and after realizing I will do some experiments with sensors, buttons etc.
Given my ignorance in this science, you will see me here.
Again …

Thanks, guys.

3 Likes

@toco you could change void loop as follows

void loop() {
  if (Blynk.connected()) 
  {   // to ensure that Blynk.run() function is only called if we are still connected to the server
    Blynk.run();
    digitalWrite(builtinled,LOW); // If connection ok builtin led on. (For this you should define builtin led on void setup as Output. By the way on NodeMCU built in led is D4 and pin number 2 on arduino ide
  }
  else
  {
    digitalWrite(builtinled,HIGH); // If connection drops builtin led off
  }
  timer.run();
}

I bought “New Wireless module CH340 NodeMcu V3 Lua WIFI Internet of Things development board based ESP8266” from China and loaded the first sketch which is being discussed above. I am totally a novice and I also face the same problem of being offline. Secondly this module is not appearing in arduino IDE.
I need guid to know about product and its version and to resolve the offline problem.

These two statements appear to conflict with each other, although it does depend what you mean when you say that the device isn’t appearing in the IDE.

Can you supply the following information…

  1. Have you installed the ESP core in the Arduino IDE, and does NodeMCU V3 appear in the board types in the IDE?
  2. Have you modified the sketch to incorporate your own Wi-Fi credentials and an an Auth code that has been generated within your app?
  3. What happens when you upload the sketch to the NodeMCU. What message do you get in the IDE?
  4. What do you see in the serial monitor? (Copy and paste the output).

Pete.

I am thankful to you sir on reply. Answers to four questions are;

  1. Yes, I have done it in preference option of arduino IDE and when I tried to download the software for ESP 8266 in board manager under tool option of arduino IDE, there the last version 2.5… is available which I downloaded too but I did not find version 3 as mentioned by the seller of ESP 8266 board. May be its version is different from that of mentioned by seller which I don’t know. Aurduino IDE is showing it unknown board. However, I selected general ESP 8266 in aurduino board select option and loaded an led blink sketch to test the board and found it working.

  2. Yes I have modified sketch according to my wifi SSID and password and Authorisation Code (copy/paste) which was emailed to me.

  3. Nothing happened and nor any message appeared in IDE.

  4. Nothing in serial monitor too.

Looking for your guidance please.
Regards

Once you’ve installed the ESP core version 2.5.x then in Tools > Board you select the type of board you are using. The board descriptions change with the version of the ESP core, and as I’m using an earlier version then “NodeMCU 1.0 (ESP12E module” is the option that i’d Choose for your board.
You also need to choose the correct serial port that your board is attached to in Tools > Port.

If you’ve installed the latest Blynk library then Sketch > Upload will compile your code and if there are no errors it will then upload it to your board. You are then at step (3) above and you can post your compile/upload results.
Upending the serial monitor from Tools > Serial Monitor and setting the baud rate to the same rate that is specified in the sketch (115200 in the sketch above) should show your device connecting to Wi-Fi and Blynk. At this point your device should show as be8 g online in the app.

Pete.

Thankyou very much I am so grateful to you sir, I have done it successfully. It was the selection of correct board.

I have also run this module over internet through IFTTT and Google Assistant on an Android phone.

  1. Can I run this without involving Google Assistant as iPhone does not have Google Assistant?

  2. Is there any application like Blynk having dashboard of buttons and controllers which can directly be connected to IFTTT or can run module over internet?

I’d suggest that you start a new topic and explain in full, with diagrams if necessary, EXACTLY what it is that you’re trying to achieve and why.

Pete.

I had learnt that Blynk dashboard works on local WiFi network not over internet. Sorry, I misunderstood that, It is already working over internet as well.

So this topic is over and I shall start new topic for my question no.1 only, thanks.

Thank you sir working again :relieved:

2 posts were split to a new topic: NodeMCU 1.0 offline