Hi, i want to send some information to the terminal in my project after booting the NodeMCU. Unfortunately i don’t get any information after booting. What am I doing wrong?
Here my configuration:
config() allows you to manage network connection. You can set up your connection type (WiFi, Ethernet, …) by yourself, and then call:
Blynk.config(auth, server, port);
or just
Blynk.config(auth);
NOTE: After Blynk.config(...) is called, your hardware is not yet connected to the server. It will try to connect while until it hits first instance of Blynk.run() or Blynk.connect() routine.
To skip connecting to the server or to disconnect manually, call Blynk.disconnect() after configuration.
Use connectWiFi to conveniently set up WiFi connection:
Blynk.connectWiFi(ssid, pass);
To connect to open WiFi networks, set pass to an empty string ( "" ).
You’re calling Blynk.config at the beginning of your void setup, but there is no Blynk.connect or Blynk.run until the code execution hits the void loop for the first time.
You have to read more carefully what @PeteKnight wrote. But to make it simple, try replacing setup() and loop() with the following code (with comment) to see what Pete means:
void setup()
{
Serial.begin(115200);
WiFiManager wifiManager;
//reset saved settings
wifiManager.resetSettings();
wifiManager.autoConnect("myBlynk-AP");
if (WiFi.status() != WL_CONNECTED)
{
Serial.println("not connected to AP!");
}
else
{
Blynk.config(auth);
// After Blynk.config(...) is called, your hardware is not yet connected to the server.
// It will try to connect while until it hits first instance of Blynk.run() or Blynk.connect() routine.
if (Blynk.connect())
{
Serial.println("Blynk connected...");
// This will print Blynk Software version to the Terminal Widget when
// your hardware gets connected to Blynk Server
terminal.println(F("Blynk v" BLYNK_VERSION ": Device started"));
terminal.println(F("-------------"));
terminal.println(F("Type 'Marco' and get a reply, or type"));
terminal.println(F("anything else and get it printed back."));
terminal.flush();
}
}
timer.setInterval(60000L, reconnectBlynk);
}
void loop()
{
Blynk.run();
timer.run();
}