Edgent - how to disable sticking pin-0?

Hi all.

Please tell me how to disable sticking PIN - 0, when turned on after Edgent firmware ???

Hardware?
Blynk library version?
What does “sticking” mean.
Which board type have you un-commented in your sketch?

Pete.

Everything is standard.
The sketch is standard.
Board - esp8266

sticking - means. When the board is rebooted, pin - 0. is on! And I need to be off. How to make the pin - 0, was in the OFF state.

And the answers to the rest of my questions?

Pete.

Hardware? - iOS 14.6 / blynk 2.0 / OS Zorin 15.3 bionic./ Arduino 1.8.12
Blynk library version - Volodymyr Shymanskyy 1.0.1

Sketch standart “Edagent” simple:

// Fill-in information from your Blynk Template here
#define BLYNK_TEMPLATE_ID "T*******6b"
#define BLYNK_DEVICE_NAME "lol"

#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
//#define USE_WEMOS_D1_MINI

#include "BlynkEdgent.h"

void setup()
{
  Serial.begin(115200);
  delay(100);
  BlynkEdgent.begin();
}

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

settings.h

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

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

  #define BOARD_BUTTON_PIN            1
  #define BOARD_BUTTON_ACTIVE_LOW     false
  
  #define BOARD_LED_PIN               2
  #define BOARD_LED_INVERSE           false
  #define BOARD_LED_BRIGHTNESS        255

#elif defined(USE_SPARKFUN_BLYNK_BOARD)

  #define BOARD_BUTTON_PIN            1
  #define BOARD_BUTTON_ACTIVE_LOW     false

  #define BOARD_LED_PIN_WS2812        4
  #define BOARD_LED_BRIGHTNESS        64

#elif defined(USE_WITTY_CLOUD_BOARD)

  #define BOARD_BUTTON_PIN            4
  #define BOARD_BUTTON_ACTIVE_LOW     false

  #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

  #warning "Custom board configuration is used"

  #define BOARD_BUTTON_PIN            1                     // Pin where user button is attached
  #define BOARD_BUTTON_ACTIVE_LOW     false                  // true if button is "active-low"

  #define BOARD_LED_PIN               4                     // 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_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 USE_TIMER_FIVE
//#define USE_PTHREAD

#define BLYNK_NO_DEFAULT_BANNER

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

I tried to change something in the settings.h, unsuccessfully …

Have you tried adding a pinMode and digitalWrite command for GPIO0 in your void setup?

Pete.

Yes, now I’ll show you exactly how I did it … just a minute.

// Fill-in information from your Blynk Template here
#define BLYNK_TEMPLATE_ID "*****P6b"
#define BLYNK_DEVICE_NAME "lol"

#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
//#define USE_WEMOS_D1_MINI

#include "BlynkEdgent.h"

int zerooffplease = 0;

void setup()
{
  Serial.begin(115200);
  delay(100);
  BlynkEdgent.begin();
  pinMode(zerooffplease, INPUT);
  digitalWrite(zerooffplease, LOW);
}

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

It did not help, when flashing and rebooting the board, pin 0, in the ON position.

How can you write to an INPUT ?

The only way to pull an input LOW is via a physical pull-down resistor.

If you wanted to pull an input HIGH then you can use INPUT_PULLUP in your pinMode statement, but there is no corresponding INPUT_PULLDOWN command for the ESP8266.

Pete.

I want pin - 0 to be turned off at board start, by default.

If anyone needs to fix the pin 0 enabled problem, I solved it like this:

// Fill-in information from your Blynk Template here
#define BLYNK_TEMPLATE_ID "T*******6b"
#define BLYNK_DEVICE_NAME "lol"

#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
//#define USE_WEMOS_D1_MINI

#include "BlynkEdgent.h"
int PIN = 0;
void setup()
{
  Serial.begin(115200);
  delay(100);
  BlynkEdgent.begin();
}

void loop() {
  BlynkEdgent.run();
  pinMode(PIN, OUTPUT);
}

A word of advice to anyone reading this - don’t put a pinMode statement in your void loop!

Pete.

Well, or describe your version.
Those who read. Sure.

pinMode statements only need to be executed once, so they normally appear in void setup(), or in a function which is called only once.

The problem that you have is that by un-commenting this line:

your code uses this board configuration in Settings.h:

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

  #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

This assigns GPIO0 to the BOARD_BUTTON_PIN variable, and true to the BOARD_BUTTON_ACTIVE_LOW variable.

in ResetButton.h, because BOARD_BUTTON_ACTIVE_LOW == true, GPIO0 is initialised as an input, with the INPUT_PULLUP modifier:

void button_init()
{
#if BOARD_BUTTON_ACTIVE_LOW
  pinMode(BOARD_BUTTON_PIN, INPUT_PULLUP);
#else
  pinMode(BOARD_BUTTON_PIN, INPUT);
#endif
  attachInterrupt(BOARD_BUTTON_PIN, button_change, CHANGE);
}

If you re-declare GPIO0 as an OUTPUT then the on-board FLASH button (which is connected to GPIO0) can’t be used to clear the WiFi credentials and force re-provisioning of the board.

Pete.

Thanks for your answer, Pete.
I will carefully study your recommendations and try to come to the right decision.