title: Arduino - unable to connect to wifi
body: <p>I have this (partial) code, that is used to read the ssid and password from a text file on a SD card.
  This data should then be used to connect to the local wifi. But it is unable to connect, and keeps saying &quot;Establishing connection to WiFi...&quot;</p>
  <p>I also dont seem to be able to print what I have read from the SD card. Previously my readline function returned a string. That I was able to print properly and verified that the file is read as expected. Then, since wifi requires a Char* I changed the code to Char* and since then it didnt work anymore:</p>
  <pre><code>#include &lt;SD.h&gt;
  #include &lt;AccelStepper.h&gt;
  #include &lt;MultiStepper.h&gt;
  #include &lt;WiFi.h&gt;
  File myFile;
  char* ssid;
  char* password;
  
  
  void setup() {
    // put your setup code here, to run once:
  
    pinMode(thetaPos, INPUT);
    pinMode(rhoPos, INPUT);
  
    Serial.begin(115200);
    Serial.print(&quot;Initializing SD card...&quot;);
    if (!SD.begin()) {
      Serial.println(&quot;initialization failed!&quot;);
      while (1);
  
    }
    Serial.println(&quot;initialization done.&quot;);
    myFile = SD.open(&quot;/config.txt&quot;);
    if (myFile) {
      // read from the file until there's nothing else in it:
      ssid = readLine();
      password = readLine();
      
        Serial.println(ssid);
        Serial.println(password);
    
    connectToNetwork();
  
      
      // close the file:
      myFile.close();
    } else {
      // file didn't open       
    }
   }
   
  void loop() {
  }
  
  
  char* readLine() {
    char* received = &quot;&quot;;
    char ch;
    while (myFile.available()) {
      ch = myFile.read();
      if (ch == '\n') {
        return received;
      } else {
        received += ch;
      }
    }
    return received;
  }
  
  void connectToNetwork() {
    WiFi.begin(ssid, password);
   
    while (WiFi.status() != WL_CONNECTED) {
      delay(1000);
      Serial.println(&quot;Establishing connection to WiFi..&quot;);
    }
   
    Serial.println(&quot;Connected to network&quot;);
   
  }
  </code></pre>
  <p>what am I doing wrong?</p>
  <p>this is the serial output:</p>
  <pre><code>Initializing SD card...initialization done.
  ore calibration nvs commit failed(0x%x)
  
  
  wdt_config-&gt;intr_handle)
  Establishing connection to WiFi..
  Establishing connection to WiFi..
  Establishing connection to WiFi..
  Establishing connection to WiFi..
  </code></pre>