khoih-prog / Blynk_WM

Blynk and WiFiManager Library for configuring/auto(re)connecting ESP8266/ESP32 modules to the best or available MultiWiFi APs and MultiBlynk servers at runtime, with or without SSL. Configuration data saved in either SPIFFS or EEPROM.
MIT License
47 stars 8 forks source link

COMPILING ERROR AFTER UPDATE #20

Closed khoih-prog closed 4 years ago

khoih-prog commented 4 years ago

The issue was posted by @chriskio in the wrong library ESP_WiFiManager as

COMPILING ERROR AFTER UPDATE



Please bear with as I'm Still learning. I am having an issue with this awesome library. I have a small sketch I am using and it works great but since I updated the library it is giving me this: Error compiling for broad NodeMCU 1.0 (ESP-12E Module). All I did was update the library and added the #define USE_LITTLEFS false to the sketch. Please help. arduino 1.18.13 broad NodeMCU 1.0 (ESP-12E Module)

#define USE_LITTLEFS    false
#define USE_SPIFFS    true
#include <BlynkSimpleEsp8266_WM.h>
BlynkTimer timer;
unsigned int notified=0;

void notifiedtimer(){
 if (digitalRead(D2)==LOW && notified==1)
 {notified=0;}
}

void ledtimer(){
if (digitalRead(D2)==LOW && notified==0)
{Blynk.virtualWrite(V1,255);
Blynk.notify("MAILBOX OPENED");
Blynk.email("MAILBOX OPENED", "GO CHECK THE MAIL");
notified=1;
}
else if (digitalRead(D2)==HIGH && notified==1)
{Blynk.virtualWrite(V1,0);
notified=0;}
}
void setup() {  
pinMode(D2,INPUT_PULLUP);
Blynk.setConfigPortal("esp8266", "1234567890");
Blynk.begin("mail");
timer.setInterval(180000L,notifiedtimer);
timer.setInterval(500L,ledtimer);
}

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

Thanks!

khoih-prog commented 4 years ago

The new version provides many new features and requires more parameters to be provided.

You'd better look at the new examples to learn more features to use them. It's advisable to use LittleFS instead of deprecated SPIFFS.

The following is the modified sketch which is compiled OK for you to try

#define USE_LITTLEFS    false
#define USE_SPIFFS      true

#include <BlynkSimpleEsp8266_WM.h>

//////
// Added for new Blynk_WM version
MenuItem myMenuItems [] = {};
uint16_t NUM_MENU_ITEMS = 0;

bool LOAD_DEFAULT_CONFIG_DATA = false;

Blynk_WM_Configuration defaultConfig =
{
  "NonSSL",
  //WiFi_Credentials  WiFi_Creds  [NUM_WIFI_CREDENTIALS]
  //WiFi_Creds.wifi_ssid and WiFi_Creds.wifi_pw
  "SSID1", "password1",
  "SSID2", "password2",
  // Blynk_Credentials Blynk_Creds [NUM_BLYNK_CREDENTIALS];
  // Blynk_Creds.blynk_server and Blynk_Creds.blynk_token
  "account.ddns.net",     "token",
  "account.duckdns.org",  "token1",
  //int  blynk_port;
  8080,
  //char board_name     [24];
  "Mail-Manager",
  //int  checkSum, dummy, not used
  0
};
/////////// End Default Config Data /////////////

//////

BlynkTimer timer;
unsigned int notified = 0;

void notifiedtimer() {
  if (digitalRead(D2) == LOW && notified == 1)
  {
    notified = 0;
  }
}

void ledtimer() 
{
  if (digitalRead(D2) == LOW && notified == 0)
  { 
    Blynk.virtualWrite(V1, 255);
    Blynk.notify("MAILBOX OPENED");
    Blynk.email("MAILBOX OPENED", "GO CHECK THE MAIL");

    notified = 1;
  }
  else if (digitalRead(D2) == HIGH && notified == 1)
  { 
    Blynk.virtualWrite(V1, 0);
    notified = 0;
  }
}
void setup() 
{
  pinMode(D2, INPUT_PULLUP);

#if ( USE_LITTLEFS )
  Serial.print("\nStarting ESP8266WM_Config using LITTLEFS");  
#elif ( USE_SPIFFS )
  Serial.print("\nStarting ESP8266WM_Config using SPIFFS");  
#endif  

  Blynk.setConfigPortal("esp8266", "1234567890");
  Blynk.begin("mail");
  timer.setInterval(180000L, notifiedtimer);
  timer.setInterval(500L, ledtimer);
}

void loop() 
{
  Blynk.run();
  timer.run();
}
chriskio commented 4 years ago

Thank you so much. All good. Love the double detect feature!

khoih-prog commented 4 years ago

You're very welcome. The library is better everyday thanks to users, like you, who report the bugs, request the enhancements, share the experience, etc.