Am trying to connect to Wi-Fi on an ESP32 using credentials i stored on an sd card, am able to read and parse the credential and printing it to the serial monitor shows that the ssid and password is correct but not connecting to Wi-Fi, when i hardcode the Wi-Fi credentials it works what could i be doing wrong

  • 1
    write a sketch that gets the SSID and password from the SD card and compares them to hardcoded values ... that will tell you if they are the same ... also, print out the length of each of them
    – jsotola
    Nov 15 '20 at 2:59
  • 1
    It would really help if you showed the code you are using.
    – jwh20
    Nov 15 '20 at 12:13
  • thanks i was able to figure it out i had to find a way to convert the string to a const char* this way: WiFi.begin(ssid.c_str(), pass.c_str()); Nov 15 '20 at 21:35

I use the NVS partition to store NON VOLATILE information.

I use this library: NVS library

You can save like string and restore after reset/off.


#include <Arduino.h>
#include "ArduinoNvs.h"

void setup() {   
    // write to flash
    String set_SSID = "WIFI_name"; 
    NVS.setString("nvs_wifi_name", set_SSID ); //upload 1 time. after comment this line and upload again **
    // read from flash
    String get_SSID = NVS.getString("nvs_wifi_name");
    Serial.printf("Wifi name stored %s\n", get_SSID);

void loop() {}  
  • This doesn't answer the question.
    – ocrdu
    Nov 16 '20 at 12:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.