'class ConfigManager' has no member named 'reset'

Hello,

I'm trying to setup my ESP8285 to connect to any available Wi-Fi network as described here: Connect Your ESP8266 To Any Available Wi-Fi network

However, whenever I verify the code, I get the below error:

'class ConfigManager' has no member named 'reset'

Here is my code:

#include <ArduinoJson.h>
#include <ESP8266WiFi.h>
#include <ConfigManager.h>
#include <PubSubClient.h> 
/******* Define Constants **********/ 
namespace{ 
    const char * AP_NAME = "Ubidots Access Point"; 
    // Assigns your Access Point name 
    const char * MQTT_SERVER = "things.ubidots.com"; 
    const char * TOKEN = "BBFF-BXutSWVNhBRDowrIHokq8OK9SXEk1S"; 
    // Assigns your Ubidots TOKEN 
    const char * DEVICE_LABEL = "Konnect"; 
    // Assigns your Device Label 
    const char * VARIABLE_LABEL = "my-variable"; 
    // Assigns your Variable Label 
    int SENSOR = A0; 
} 
char topic[150];
char payload[50];
String clientMac = ""; 
unsigned char mac[6]; 
struct Config { 
    char name[20]; 
    bool enabled; 
    int8 hour; 
} config;
/******* Initialize a global instance **********/

WiFiClient espClient; 
PubSubClient client(espClient); 
ConfigManager configManager; 

/***************Auxiliar Functions ********************/ 
void callback(char* topic, byte* payload, unsigned int length){ } 
void reconnect() { 
    while (!client.connected()){
        Serial.print("Attempting MQTT connection...");
        // Attempt to connect 
            if (client.connect(clientMac.c_str(), TOKEN, NULL)) { 
                Serial.println("connected"); 
                break; 
            } 
            else { 
                configManager.reset(); 
                Serial.print("failed, rc="); 
                Serial.print(client.state()); 
                Serial.println(" try again in 3 seconds"); 
                for(uint8_t Blink=0; Blink<=3; Blink++){ 
                    digitalWrite(LED, LOW); 
                    delay(500); 
                    digitalWrite(LED, HIGH); 
                    delay(500); 
                }
            }
        }
    }
String macToStr(const uint8_t* mac) { 
    String result; 
    for (int i = 0; i < 6; ++i) { 
        result += String(mac[i], 16); 
        if (i < 5)result += ':';
    } 
    return result; 
}
        
/********* Main Functions *************/

void setup() { 
    Serial.begin(115200); 
    /* Declare PINs as input/output */
    pinMode(SENSOR, INPUT); 
    pinMode(PIN_RESET, INPUT); 
    pinMode(LED, OUTPUT); 
    /* Assign WiFi MAC address as MQTT client name */ 
    WiFi.macAddress(mac); 
    clientMac += macToStr(mac); 
    /* Access Point configuration */ 
    configManager.setAPName(AP_NAME); 
    configManager.addParameter("name", config.name, 20);
    configManager.addParameter("enabled", &config.enabled);
    configManager.addParameter("hour", &config.hour); 
    configManager.begin(config); 
    /* Set Sets the server details */ 
    client.setServer(MQTT_SERVER, 1883); 
    client.setCallback(callback); 
    /* Build the topic request */ 
    sprintf(topic, "%s%s", "/v1.6/devices/", DEVICE_LABEL); 
}

void loop() { 
    configManager.reset(); 
    configManager.loop(); 
    /* MQTT client reconnection */ 
    if (!client.connected()) { 
        reconnect(); 
    } 
    /* Sensor Reading */ 
    int value = analogRead(SENSOR); 
    /* Build the payload request */ 
    sprintf(payload, "{\"%s\": %d}", VARIABLE_LABEL, value); 
    /* Publish sensor value to Ubidots */ 
    client.publish(topic, payload); 
    client.loop(); 
    delay(5000);
}

Please, help

You have the wrong version of the ConfigManager library installed. The tutorial specifies that you must use the mariacarlinahernandez fork of the ConfigManager library, not the original nrwiersma library.

First, you must uninstall the incorrect library:

  • File > Examples > ConfigManager > save_config_demo
  • Sketch > Show Sketch Folder. This will open the folder containing the ConfigManager library's save_config_demo example sketch.
  • Navigate up three folder levels to the libraries folder.
  • Delete the ConfigManager folder (or similar name, depending on how you installed the library).

Next, you must install the correct library:

Now you should be able to compile the sketch without an error.

Thanks for your help, I've done that and I still encountered errors:

Error while detecting libraries included by C:\Users\HPELIT~1\AppData\Local\Temp\arduino_build_392399\sketch\Any_Network.ino.cpp

Error while detecting libraries included by C:\Users\HP EliteBook 840 G2\Documents\Arduino\libraries\ConfigManager-master\src\ConfigManager.cpp

In file included from C:\Users\HP EliteBook 840 G2\Documents\Arduino\Any_Network\Any_Network.ino:4:0:

C:\Users\HP EliteBook 840 G2\Documents\Arduino\libraries\ConfigManager-master\src/ConfigManager.h:5:9: error: macro names must be identifiers

#define 1

^

Same code.

Did you modify the library? ConfigManager.h, line 5 is:

#define PIN_RESET 5

but in your installation, it is:

#define 1

Yeah, I did that.

If you want to change the reset pin to pin 1, the correct code is:

#define PIN_RESET 1