WifiManager not working

  • This is my first project using a wemos D1 mini.
    I have written a sketch for door entry exit system running on a wemos D1 mini that now runs as I want it to.
    I am trying to add wifimanager auto connect, if I upload the sketches one at a time both work fine. If I merge the two, the sketch uploads fine, however just hangs. There is no web server AP or anything.

    Please can anyone see anything that jumps out below that would cause the auto connect not to function.

    Thanks in advance.

    #include <ESP8266WiFi.h> //https://github.com/esp8266/Arduino
    #include <DNSServer.h>
    #include <ESP8266WebServer.h>
    #include <WiFiManager.h> //https://github.com/tzapu/WiFiManager
    #include <Keypad.h>
    #include <Password.h>

    String newPasswordString; //hold the new password
    char newPassword[6]; //charater string of newPasswordString
    boolean stringComplete = false;

    Password password = Password( "1234" );//initialize password to 1234

    byte maxPasswordLength = 6;
    byte currentPasswordLength = 0;
    const byte ROWS = 4; // Four rows
    const byte COLS = 4; // Four columns

    //Define the keymap
    char keys[ROWS][COLS] = {
    {'1', '2', '3', 'A'},
    {'4', '5', '6', 'B'},
    {'7', '8', '9', 'C'},
    {'*', '0', '#', 'D'}

    byte rowPins[ROWS] = {8, 7, 6, 5}; //connect to the row pinouts of the keypad
    byte colPins[COLS] = {4, 3, 2, 1};//connect to the column pinouts of the keypad

    // Create the Keypad
    Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

    void setup() {
    // put your setup code here, to run once:

    //Local intialization. Once its business is done, there is no need to keep it around
    WiFiManager wifiManager;
    //reset saved settings
    //set custom ip for portal
    //wifiManager.setAPStaticIPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0));
    //fetches ssid and pass from eeprom and tries to connect
    //if it does not connect it starts an access point with the specified name
    //here  "AutoConnectAP"
    //and goes into a blocking loop awaiting configuration
    //or use this for auto generated name ESP + ChipID
    //if you get here you have connected to the WiFi
    Serial.println("connected...yeey :)");


    void loop() {
    char key = keypad.getKey();
    if (key != NO_KEY) {
    switch (key) {
    case 'A': break;
    case 'B': break;
    case 'C': break;
    case 'D': changePassword(); break;
    case '*': checkPassword(); break;
    case '#': resetPassword(); break;
    default: processNumberKey(key);

    void processNumberKey(char key) {
    if (currentPasswordLength == maxPasswordLength) {

    void checkPassword() {
    if (password.evaluate()) {
    Serial.println(" OK.");
    } else {
    Serial.println(" Wrong passwowrd!");

    void resetPassword() {
    currentPasswordLength = 0;

    void changePassword() {

    newPasswordString.toCharArray(newPassword, newPasswordString.length() + 1); //convert string to char array
    Serial.print("Password changed to ");

    // Read serial input:
    while (Serial.available() > 0) {
    int inChar = Serial.read();
    if (isDigit(inChar)) {
    // convert the incoming byte to a char
    // and add it to the string:
    newPasswordString += (char)inChar;
    // if you get a newline, print the string,
    // then the string's value:
    if (inChar == '#') {

      if (inChar == '*') {  // If carriage return
        stringComplete = true;



  • @andi968

    When including code for people to review create a new line and enter three backticks. (The backtick is the key above the 'Tab' key.) On the next line, paste your code. Then on a new blank line, place three more backticks to end the code segment.

    // This is code because its preceded and followed by three backticks e.g. ```

Log in to reply

Looks like your connection to WEMOS Forum was lost, please wait while we try to reconnect.