BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       👉 SKETCH BUILDER

ESP8266 problem sketch error

Hello everybody,

i’m trying to put this sketch on an esp8266 but when i upload the sketch i get this error info on the serial monitor, even though i copied it from my dashboard and pasted it into my sketch i get the error message of:

    ___ __ __
    / _ )/ /_ _____ / /__
   / _ / / // / _ \/ '_/
  /____/_/\_, /_//_/_/\_\
         /___/ v1.0.1 on NodeMCU

[3437] Using Dynamic IP: 192.168.15.8
[3650] Current time: Tue Sep 6 22:39:34 2022
[3650] Connecting to blynk.cloud:443
[5220] Invalid auth token

What am I doing wrong, could someone help me?
Thanks in advance!


// Fill-in information from your Blynk Template here
#define BLYNK_TEMPLATE_ID "xxxx"
#define BLYNK_DEVICE_NAME "DimerControl"
#define BLYNK_AUTH_TOKEN "xxx"

#define BLYNK_FIRMWARE_VERSION        "0.1.0"

#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG

//#define APP_DEBUG

// Uncomment your board, or configure a custom board in Settings.h
//#define USE_SPARKFUN_BLYNK_BOARD
#define USE_NODE_MCU_BOARD
//#define USE_WITTY_CLOUD_BOARD

#include "BlynkEdgent.h"
#include <AceButton.h>
using namespace ace_button;

// define the GPIO connected with Relays and switches
#define RelayPin1 5  //D1
#define RelayPin2 4  //D2
#define RelayPin3 13 //D7
#define RelayPin4 12 //D6

#define SwitchPin1 10  //SD3
#define SwitchPin2 D3   //D3 
#define SwitchPin3 14  //D5
#define SwitchPin4 3   //RX

#define wifiLed   16   //D0

//Change the virtual pins according the rooms
#define VPIN_BUTTON_1    V1
#define VPIN_BUTTON_2    V2
#define VPIN_BUTTON_3    V3 
#define VPIN_BUTTON_4    V4

int toggleState_1 = 0; //Define integer to remember the toggle state for relay 1
int toggleState_2 = 0; //Define integer to remember the toggle state for relay 2
int toggleState_3 = 0; //Define integer to remember the toggle state for relay 3
int toggleState_4 = 0; //Define integer to remember the toggle state for relay 4

ButtonConfig config1;
AceButton button1(&config1);
ButtonConfig config2;
AceButton button2(&config2);
ButtonConfig config3;
AceButton button3(&config3);
ButtonConfig config4;
AceButton button4(&config4);

void handleEvent1(AceButton*, uint8_t, uint8_t);
void handleEvent2(AceButton*, uint8_t, uint8_t);
void handleEvent3(AceButton*, uint8_t, uint8_t);
void handleEvent4(AceButton*, uint8_t, uint8_t);

void relayOnOff(int relay){
    switch(relay){
      case 1: 
             if(toggleState_1 == 0){
              digitalWrite(RelayPin1, LOW); // turn on relay 1
              toggleState_1 = 1;
              Serial.println("Device1 ON");
              }
             else{
              digitalWrite(RelayPin1, HIGH); // turn off relay 1
              toggleState_1 = 0;
              Serial.println("Device1 OFF");
              }
             delay(100);
      break;
      case 2: 
             if(toggleState_2 == 0){
              digitalWrite(RelayPin2, LOW); // turn on relay 2
              toggleState_2 = 1;
              Serial.println("Device2 ON");
              }
             else{
              digitalWrite(RelayPin2, HIGH); // turn off relay 2
              toggleState_2 = 0;
              Serial.println("Device2 OFF");
              }
             delay(100);
      break;
      case 3: 
             if(toggleState_3 == 0){
              digitalWrite(RelayPin3, LOW); // turn on relay 3
              toggleState_3 = 1;
              Serial.println("Device3 ON");
              }
             else{
              digitalWrite(RelayPin3, HIGH); // turn off relay 3
              toggleState_3 = 0;
              Serial.println("Device3 OFF");
              }
             delay(100);
      break;
      case 4: 
             if(toggleState_4 == 0){
              digitalWrite(RelayPin4, LOW); // turn on relay 4
              toggleState_4 = 1;
              Serial.println("Device4 ON");
              }
             else{
              digitalWrite(RelayPin4, HIGH); // turn off relay 4
              toggleState_4 = 0;
              Serial.println("Device4 OFF");
              }
             delay(100);
      break;
      default : break;      
      }  
}

BLYNK_CONNECTED() {
  // Request the latest state from the server
  Blynk.syncVirtual(VPIN_BUTTON_1);
  Blynk.syncVirtual(VPIN_BUTTON_2);
  Blynk.syncVirtual(VPIN_BUTTON_3);
  Blynk.syncVirtual(VPIN_BUTTON_4);
}

// When App button is pushed - switch the state

BLYNK_WRITE(VPIN_BUTTON_1) {
  toggleState_1 = param.asInt();
  if(toggleState_1 == 1){
    digitalWrite(RelayPin1, LOW);
  }
  else { 
    digitalWrite(RelayPin1, HIGH);
  }
}

BLYNK_WRITE(VPIN_BUTTON_2) {
  toggleState_2 = param.asInt();
  if(toggleState_2 == 1){
    digitalWrite(RelayPin2, LOW);
  }
  else { 
    digitalWrite(RelayPin2, HIGH);
  }
}

BLYNK_WRITE(VPIN_BUTTON_3) {
  toggleState_3 = param.asInt();
  if(toggleState_3 == 1){
    digitalWrite(RelayPin3, LOW);
  }
  else { 
    digitalWrite(RelayPin3, HIGH);
  }
}

BLYNK_WRITE(VPIN_BUTTON_4) {
  toggleState_4 = param.asInt();
  if(toggleState_4 == 1){
    digitalWrite(RelayPin4, LOW);
  }
  else { 
    digitalWrite(RelayPin4, HIGH);
  }
}

void setup()
{
  Serial.begin(115200);
  delay(100);
  
  pinMode(RelayPin1, OUTPUT);
  pinMode(RelayPin2, OUTPUT);
  pinMode(RelayPin3, OUTPUT);
  pinMode(RelayPin4, OUTPUT);

  pinMode(wifiLed, OUTPUT);

  pinMode(SwitchPin1, INPUT_PULLUP);
  pinMode(SwitchPin2, INPUT_PULLUP);
  pinMode(SwitchPin3, INPUT_PULLUP);
  pinMode(SwitchPin4, INPUT_PULLUP);

  //During Starting all Relays should TURN OFF
  digitalWrite(RelayPin1, HIGH);
  digitalWrite(RelayPin2, HIGH);
  digitalWrite(RelayPin3, HIGH);
  digitalWrite(RelayPin4, HIGH);

  digitalWrite(wifiLed, HIGH);

  config1.setEventHandler(button1Handler);
  config2.setEventHandler(button2Handler);
  config3.setEventHandler(button3Handler);
  config4.setEventHandler(button4Handler);

  button1.init(SwitchPin1);
  button2.init(SwitchPin2);
  button3.init(SwitchPin3);
  button4.init(SwitchPin4);

  BlynkEdgent.begin();

  Blynk.virtualWrite(VPIN_BUTTON_1, toggleState_1);
  Blynk.virtualWrite(VPIN_BUTTON_2, toggleState_2);
  Blynk.virtualWrite(VPIN_BUTTON_3, toggleState_3);
  Blynk.virtualWrite(VPIN_BUTTON_4, toggleState_4);

  //timer.setInterval(3000L, checkBlynkStatus); // check if Blynk server is connected every 3 seconds
}

void loop() {

    BlynkEdgent.run();

    //Manual Switch Control
    button1.check();
    button2.check();
    button3.check();
    button4.check();
}

void button1Handler(AceButton* button, uint8_t eventType, uint8_t buttonState) {
  Serial.println("EVENT1");
  relayOnOff(1);
  Blynk.virtualWrite(VPIN_BUTTON_1, toggleState_1);   // Update Button Widget
}
void button2Handler(AceButton* button, uint8_t eventType, uint8_t buttonState) {
  Serial.println("EVENT2");
  relayOnOff(2);
  Blynk.virtualWrite(VPIN_BUTTON_2, toggleState_2);   // Update Button Widget
}
void button3Handler(AceButton* button, uint8_t eventType, uint8_t buttonState) {
  Serial.println("EVENT3");
  relayOnOff(3);
  Blynk.virtualWrite(VPIN_BUTTON_3, toggleState_3);   // Update Button Widget
}
void button4Handler(AceButton* button, uint8_t eventType, uint8_t buttonState) {
  Serial.println("EVENT4");
  relayOnOff(4);
  Blynk.virtualWrite(VPIN_BUTTON_4, toggleState_4);   // Update Button Widget
}

If you’re using the Edgent example then you shouldn’t be specifying the Auth token, as this is allocated dynamically.
If you’ve manually created a device from the template you have created then you should delete this device. If not then you should reconfigure the device via the app.

Pete.

Hi Pete, thanks for the reply, I did what you suggested, deleted the old project and created a new one, left the sketch without autotoken, but still I keep getting this message (See image please) I know I must be doing something wrong , I appreciate if you can help me to find out where I’m going wrong.Thanks!

Hi Pete,
I already managed to connect, the error is because my cell phone had the data from my old network, after moving some things on the cell phone I managed to connect, a doubt I have now is the following, when I take this ESP to another place on another network, it will connect in station mode and via srmartphone I will be able to connect it to the new network? that’s how it works? Thanks.

With the nodmcu board it works perfect, but when I load the same code on my stand alone board, just see this image on the serial monitor, and it doesn’t connect

  / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v1.0.1 on NodeMCU

You’re asking lots of random unstructured questions and posting screenshots instead of correctly formatted serial output and code.

When you use the Edgent example, you choose a board type in your Edgent sketch…

The Settings.h tab of your sketch defines the LED and reset button pins for that board type. In your case GPIO2 and GPIO0.

When you press and hold the button attached to GPIO0 (bottom left button) for 10 seconds your LED will start to flash rapidly and the device will be in provisioning mode. You then re-provision the device via the mobile app, not via a static portal.

As for your last question, you need to fix the serial monitor formatting but adding triple backticks at the beginning and end, and add significantly more information to make your question understandable.

Triple backticks look like this:
```

Pete.

You’re asking lots of random unstructured questions and posting screenshots instead of correctly formatted serial output and code.

kwiek:

when I take this ESP to another place on another network, it will connect in station mode and via srmartphone I will be able to connect it to the new network? that's how it works?

When you use the Edgent example, you choose a board type in your Edgent sketch…

kwiek:

Hi Pete,
Thanks for your patience, and sorry for the way of posting, I’ll try to correct that.

And I’ll try to go by parts, first, I’m not able to make the ESP connect to another network.

I pressed the button on GPIO 0 called boot for 10 seconds, and the result on the serial monitor is this

[5841] Using Dynamic IP: 192.168.15.3
[5954] Current time: Wed Sep 7 17:46:33 2022
[5954] Connecting to blynk.cloud:443
[6000] Connection failed
[10860] Current time: Wed Sep 7 17:46:37 2022
[10860] Connecting to blynk.cloud:443
[12383] Ready (ping: 12ms).
EVENT2
Device2 ON
EVENT2
Device2 OFF

LED does not blink

If you pressed the GPIO0 button then you’d see some messages in your serial monitor about this.
Did your LED blink correctly initially? If not, how did you do the initial provisioning?

Pete.

Pete,
honestly when I did initially I just looked at what I was doing on the smartphone, I didn’t look at the ESP and its LED, then I saw that it connected asking for the password and name of my network to choose

Thank you!

So when you press the GPIO0 button now, do you see a message in the serial monitor about keeping the button pressed for 10 seconds, then a message about clearing the stored data?

Pete.

Hi Pete,
No, the only message I see in ms is this one below, event on, event off

[39964] Falha na conexão
[44857] Hora atual: Qui 8 de setembro 16:07:52 2022
[44857] Conectando-se ao blynk.cloud:443
[44977] Falha na conexão
[49867] Hora atual: Qui 8 de setembro 16:07:57 2022
[49868] Conectando-se ao blynk.cloud:443
[51434] Pronto (ping: 12ms).
EVENTO2
Dispositivo2 LIGADO
EVENTO2
Dispositivo 2 DESLIGADO

In that case, either you are pressing the wrong button, or you’ve changed the ESP8266 board type settings in Settings.h, or you’ve re-used GPIO0 and GPIO2 elsewhere in your sketch, or your board has a faulty GPIO0 button.

Pete.

Hi Pete,

I believe that none of the three options are valid, See here my page settings.h tab

I didn’t make any changes here


*
 * General options
 */

#define BOARD_HARDWARE_VERSION        "1.0.0"

/*
 * Board configuration (see examples below).
 */

#if defined(USE_NODE_MCU_BOARD)

  #warning "NodeMCU board selected"

  // Example configuration for NodeMCU v1.0 Board
  #define BOARD_BUTTON_PIN            D4
  #define BOARD_BUTTON_ACTIVE_LOW     true

  #define BOARD_LED_PIN_R             D8
  //#define BOARD_LED_PIN_G           D7
  //#define BOARD_LED_PIN_B           D6
  #define BOARD_LED_INVERSE           false
  #define BOARD_LED_BRIGHTNESS        64

#elif defined(USE_SPARKFUN_BLYNK_BOARD)

  #warning "Sparkfun Blynk board selected"

  // Example configuration for SparkFun Blynk Board
  #define BOARD_BUTTON_PIN            0
  #define BOARD_BUTTON_ACTIVE_LOW     true

  #define BOARD_LED_PIN_WS2812        4
  #define BOARD_LED_BRIGHTNESS        64

#elif defined(USE_WITTY_CLOUD_BOARD)

  #warning "Witty Cloud board selected"

  // Example configuration for Witty cloud Board
  #define BOARD_BUTTON_PIN            4
  #define BOARD_BUTTON_ACTIVE_LOW     true

  #define BOARD_LED_PIN_R             15
  #define BOARD_LED_PIN_G             12
  #define BOARD_LED_PIN_B             13
  #define BOARD_LED_INVERSE           false
  #define BOARD_LED_BRIGHTNESS        64

#else

  // Custom board configuration
  #define BOARD_BUTTON_PIN            0                     // Pin where user button is attached
  #define BOARD_BUTTON_ACTIVE_LOW     true                  // true if button is "active-low"

  #define BOARD_LED_PIN               15                    // Set LED pin - if you have a single-color LED attached
  //#define BOARD_LED_PIN_R           15                    // Set R,G,B pins - if your LED is PWM RGB 
  //#define BOARD_LED_PIN_G           12
  //#define BOARD_LED_PIN_B           13
  //#define BOARD_LED_PIN_WS2812      4                     // Set if your LED is WS2812 RGB
  #define BOARD_LED_INVERSE           false                 // true if LED is common anode, false if common cathode
  #define BOARD_LED_BRIGHTNESS        64                    // 0..255 brightness control

#endif


/*
 * Advanced options
 */

#define BUTTON_HOLD_TIME_INDICATION   3000
#define BUTTON_HOLD_TIME_ACTION       10000

#define BOARD_PWM_MAX                 1023

#define CONFIG_AP_URL                 "blynk.setup"
#define CONFIG_DEFAULT_SERVER         "blynk.cloud"
#define CONFIG_DEFAULT_PORT           443

#define WIFI_NET_CONNECT_TIMEOUT      30000
#define WIFI_CLOUD_CONNECT_TIMEOUT    60000
#define WIFI_AP_CONFIG_PORT           80
#define WIFI_AP_IP                    IPAddress(192, 168, 4, 1)
#define WIFI_AP_Subnet                IPAddress(255, 255, 255, 0)
//#define WIFI_CAPTIVE_PORTAL_ENABLE

#define USE_TICKER
//#define USE_TIMER_ONE
//#define USE_TIMER_THREE

#define BLYNK_NO_DEFAULT_BANNER

#if defined(APP_DEBUG)
  #define DEBUG_PRINT(...) BLYNK_LOG1(__VA_ARGS__)
#else
  #define DEBUG_PRINT(...)
#endif```

In my sketch I am not using GPIO0 or 2 please see my sketch


#define BLYNK_TEMPLATE_ID "TMPLWAsLobKt"
#define BLYNK_DEVICE_NAME "Dimer"

#define BLYNK_FIRMWARE_VERSION        "0.1.0"

#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG

//#define APP_DEBUG

// Uncomment your board, or configure a custom board in Settings.h
//#define USE_SPARKFUN_BLYNK_BOARD
#define USE_NODE_MCU_BOARD
//#define USE_WITTY_CLOUD_BOARD

#include "BlynkEdgent.h"
#include <AceButton.h>
using namespace ace_button;

// define the GPIO connected with Relays and switches
#define RelayPin1 12  //D6
#define RelayPin2 4  //D2
#define RelayPin3 13 //D7
#define RelayPin4 2 //D4

#define SwitchPin1 10  //SD3
#define SwitchPin2 D3   //D3 
#define SwitchPin3 14  //D5
#define SwitchPin4 3   //RX

#define wifiLed   16   //D0

//Change the virtual pins according the rooms
#define VPIN_BUTTON_1    V1
#define VPIN_BUTTON_2    V2
#define VPIN_BUTTON_3    V3 
#define VPIN_BUTTON_4    V4

int toggleState_1 = 0; //Define integer to remember the toggle state for relay 1
int toggleState_2 = 0; //Define integer to remember the toggle state for relay 2
int toggleState_3 = 0; //Define integer to remember the toggle state for relay 3
int toggleState_4 = 0; //Define integer to remember the toggle state for relay 4

ButtonConfig config1;
AceButton button1(&config1);
ButtonConfig config2;
AceButton button2(&config2);
ButtonConfig config3;
AceButton button3(&config3);
ButtonConfig config4;
AceButton button4(&config4);

void handleEvent1(AceButton*, uint8_t, uint8_t);
void handleEvent2(AceButton*, uint8_t, uint8_t);
void handleEvent3(AceButton*, uint8_t, uint8_t);
void handleEvent4(AceButton*, uint8_t, uint8_t);

void relayOnOff(int relay){
    switch(relay){
      case 1: 
             if(toggleState_1 == 0){
              digitalWrite(RelayPin1, LOW); // turn on relay 1
              toggleState_1 = 1;
              Serial.println("Device1 ON");
              }
             else{
              digitalWrite(RelayPin1, HIGH); // turn off relay 1
              toggleState_1 = 0;
              Serial.println("Device1 OFF");
              }
             delay(100);
      break;
      case 2: 
             if(toggleState_2 == 0){
              digitalWrite(RelayPin2, LOW); // turn on relay 2
              toggleState_2 = 1;
              Serial.println("Device2 ON");
              }
             else{
              digitalWrite(RelayPin2, HIGH); // turn off relay 2
              toggleState_2 = 0;
              Serial.println("Device2 OFF");
              }
             delay(100);
      break;
      case 3: 
             if(toggleState_3 == 0){
              digitalWrite(RelayPin3, LOW); // turn on relay 3
              toggleState_3 = 1;
              Serial.println("Device3 ON");
              }
             else{
              digitalWrite(RelayPin3, HIGH); // turn off relay 3
              toggleState_3 = 0;
              Serial.println("Device3 OFF");
              }
             delay(100);
      break;
      case 4: 
             if(toggleState_4 == 0){
              digitalWrite(RelayPin4, LOW); // turn on relay 4
              toggleState_4 = 1;
              Serial.println("Device4 ON");
              }
             else{
              digitalWrite(RelayPin4, HIGH); // turn off relay 4
              toggleState_4 = 0;
              Serial.println("Device4 OFF");
              }
             delay(100);
      break;
      default : break;      
      }  
}

BLYNK_CONNECTED() {
  // Request the latest state from the server
  Blynk.syncVirtual(VPIN_BUTTON_1);
  Blynk.syncVirtual(VPIN_BUTTON_2);
  Blynk.syncVirtual(VPIN_BUTTON_3);
  Blynk.syncVirtual(VPIN_BUTTON_4);
}

// When App button is pushed - switch the state

BLYNK_WRITE(VPIN_BUTTON_1) {
  toggleState_1 = param.asInt();
  if(toggleState_1 == 1){
    digitalWrite(RelayPin1, LOW);
  }
  else { 
    digitalWrite(RelayPin1, HIGH);
  }
}

BLYNK_WRITE(VPIN_BUTTON_2) {
  toggleState_2 = param.asInt();
  if(toggleState_2 == 1){
    digitalWrite(RelayPin2, LOW);
  }
  else { 
    digitalWrite(RelayPin2, HIGH);
  }
}

BLYNK_WRITE(VPIN_BUTTON_3) {
  toggleState_3 = param.asInt();
  if(toggleState_3 == 1){
    digitalWrite(RelayPin3, LOW);
  }
  else { 
    digitalWrite(RelayPin3, HIGH);
  }
}

BLYNK_WRITE(VPIN_BUTTON_4) {
  toggleState_4 = param.asInt();
  if(toggleState_4 == 1){
    digitalWrite(RelayPin4, LOW);
  }
  else { 
    digitalWrite(RelayPin4, HIGH);
  }
}

void setup()
{
  Serial.begin(115200);
  delay(100);
  
  pinMode(RelayPin1, OUTPUT);
  pinMode(RelayPin2, OUTPUT);
  pinMode(RelayPin3, OUTPUT);
  pinMode(RelayPin4, OUTPUT);

  pinMode(wifiLed, OUTPUT);

  pinMode(SwitchPin1, INPUT_PULLUP);
  pinMode(SwitchPin2, INPUT_PULLUP);
  pinMode(SwitchPin3, INPUT_PULLUP);
  pinMode(SwitchPin4, INPUT_PULLUP);

  //During Starting all Relays should TURN OFF
  digitalWrite(RelayPin1, HIGH);
  digitalWrite(RelayPin2, HIGH);
  digitalWrite(RelayPin3, HIGH);
  digitalWrite(RelayPin4, HIGH);

  digitalWrite(wifiLed, HIGH);

  config1.setEventHandler(button1Handler);
  config2.setEventHandler(button2Handler);
  config3.setEventHandler(button3Handler);
  config4.setEventHandler(button4Handler);

  button1.init(SwitchPin1);
  button2.init(SwitchPin2);
  button3.init(SwitchPin3);
  button4.init(SwitchPin4);

  BlynkEdgent.begin();

  Blynk.virtualWrite(VPIN_BUTTON_1, toggleState_1);
  Blynk.virtualWrite(VPIN_BUTTON_2, toggleState_2);
  Blynk.virtualWrite(VPIN_BUTTON_3, toggleState_3);
  Blynk.virtualWrite(VPIN_BUTTON_4, toggleState_4);

  //timer.setInterval(3000L, checkBlynkStatus); // check if Blynk server is connected every 3 seconds
}

void loop() {

    BlynkEdgent.run();

    //Manual Switch Control
    button1.check();
    button2.check();
    button3.check();
    button4.check();
}

void button1Handler(AceButton* button, uint8_t eventType, uint8_t buttonState) {
  Serial.println("EVENT1");
  relayOnOff(1);
  Blynk.virtualWrite(VPIN_BUTTON_1, toggleState_1);   // Update Button Widget
}
void button2Handler(AceButton* button, uint8_t eventType, uint8_t buttonState) {
  Serial.println("EVENT2");
  relayOnOff(2);
  Blynk.virtualWrite(VPIN_BUTTON_2, toggleState_2);   // Update Button Widget
}
void button3Handler(AceButton* button, uint8_t eventType, uint8_t buttonState) {
  Serial.println("EVENT3");
  relayOnOff(3);
  Blynk.virtualWrite(VPIN_BUTTON_3, toggleState_3);   // Update Button Widget
}
void button4Handler(AceButton* button, uint8_t eventType, uint8_t buttonState) {
  Serial.println("EVENT4");
  relayOnOff(4);
  Blynk.virtualWrite(VPIN_BUTTON_4, toggleState_4);   // Update Button Widget
}

Finally it is impossible that the boot button is having problems, because I use the same to load the sketch, that is, I press boot and hold, and press reset to enter the mode to load the sketch, and I tested the same on 3 different boards, so I don’t think the problem is any of the options you mention, please take my words without any arrogance or lack of respect, I’m just trying to show what is happening, and I have a deep respect for you whom I admire for your enormous knowledge and your willingness to share and help everyone here to solve their problems.
I await your valuable comments, and who knows, you may find some error that I am not seeing in the sketches I posted.
Thank you very much for your kindness.
My sincere thanks.
Carlos.

Well, the latest Settings.h example from here looks like this for the NodeMCU/Wemos D1 Mini board…

#if defined(USE_NODE_MCU_BOARD) || defined(USE_WEMOS_D1_MINI)

  #if defined(USE_WEMOS_D1_MINI)
    #warning "This board does not have a button. Connect a button to gpio0 <> GND"
  #endif

  #define BOARD_BUTTON_PIN            0
  #define BOARD_BUTTON_ACTIVE_LOW     true

  #define BOARD_LED_PIN               2
  #define BOARD_LED_INVERSE           true
  #define BOARD_LED_BRIGHTNESS        255

It’s not surprising that your board isn’t responding to presses of the GPIO0 (D3) button, or flashing the onboard LED which is connected to GPIO2 (D4), as you aren’t specifying these as the button and LED pins in your sketch.

You’re actually using GOIO0 (D3) as SwitchPin2

I’s also avoid using GPIO10, GPIO3 and GPIO16 if I were you, which probably means you ought to be using an ESP32.

You should also do yourself a favour by always using GOIO numbers in your sketch, with the correct “D” number alongside in the comments as that makes it much easier top track which pins are being used for what.

You may find this link useful…

as well as this one…

Pete.

Hi Pete,
Once again I want to thank you for your patience and willingness to help.
I’m trying to follow your instructions to see if I can save my project, however I should try to use ESP8266 since I had 30 plates made and I have no way to switch to ESP32 now, who knows in the future.

Anyway, I believe that with the existing GPIOS it would be possible to use the 8266, I aligned a GPIO, since I only need 3 outputs and three inputs, as you can see in the sketch below, I eliminated the GPIO0 and 4 from the sketch, even so, I still have the same problem, no matter how much I press the GPIO0 for a few seconds, it doesn’t enter the mode expected to enter to add a new network.
I think it has something to do with what you explain here.

Not surprisingly, your board is not responding to pressing the GPIO0 (D3) button or flashing the onboard LED that is connected to the GPIO2 (D4), as you are not specifying them as the button and LED pins in your sketch.

This is how my sketch is now without using GPIO0 or GPIO4
Excerpt only

// define the GPIO connected with Relays and switches
#define RelayPin1 12 //D6
#define RelayPin2 15 //D8
#define RelayPin3 13 //D7
//#define RelayPin4 2 //D4

//#define SwitchPin1 10 //SD3
#define SwitchPin1 10 //SD3
#define SwitchPin2 14 //D5
#define SwitchPin3 3 //RX

#define wifiLed 16 //D0

Pete, I don’t know where and how to declare the LED and button as you suggest, could you please direct me where and how should I do this in my sketch for it to work?

Image of my ESP8266f pinout

esp-12f

Thank you very much in advance for what you can do.

Thanks!
kwiek

In that case, I guess you haven’t read the “Defining your physical switch and LED” section of the tutorial that I linked to…

If you have read it and stil don’t understand it them I’d suffers that that you ask me very specific questions about the sections you don’t understand, quoting specific sections of the tutorial and explaining which sections you don’t understand.

Pete.

Hi Pete,

It’s not that I haven’t read it, I read it, but I don’t know whether or not I should do something, my board is a nodemcu, and I left everything as it is by default, but when I press the flash button, nothing happens, no message on the serial monitor, and no change that takes the ESP to another state and that I can connect to another network, I really think my limits have been crossed and I should let that go.

Thanks for your help, I wish you good luck and send you my greetings.
kwiek

Well, your current settings aren’t the default values in the latest version of the Edgent example for the NodeMCU. Until you change the values in Settings.h you won’t make any progress.

As you’re either using a very old version of the Edgent example, or that example has been hacked around in some way, I’d suggest that you take a new copy of all the ESP8266 Edgent example files from the Blynk GitHub site (link above) and just put your current .ino file in there.

Pete.

1 Like

Dear Pete,

I did what you recommended and now everything works properly, the LED stays on when it is connected, and it blinks if I keep the flash button pressed for a short period, writing thank you very much for the valuable help is not enough taking into account what it means for me the solution to my problem, I would also like to thank you for not only giving me the fish, but also teaching me how to fish, in other words, you gave me the solution, but you showed me how to get it and how use it, very generous of you to share your knowledge with me and all colleagues.
Thanks again for your patience, and for your teaching.
Greetings from Brazil.

kwiek

1 Like