Bonsoir,
J'ai testé la solution proposée mais j'ai l'erreur :
invalid conversion from 'const char*' to 'char*' [-fpermissive]
le code utilisé est
#include <NTPtimeESP.h>
#include <SPI.h> // liaison avec le shield sd card
#include <SD.h> // gestion sd card
#define DEBUG_ON
NTPtime NTPch("pool.ntp.org"); // Choose server pool as required : time.google.com , fr.pool.ntp.org , ch.pool.ntp.org, pool.ntp.org
strDateTime dateTime;
#define PIN 12 // GPIO12 correspond à la pin D6 DU WEMOS mini D1 . Envoi les datas vers le ruban de leds
#define NUMPIXELS 144 // 144 leds en série
const int chipSelect = D4; // D4 (GPIO2) pin wemos utilisé pour la carte sd
String wifiSSID, wifiPass,Serveur;
void setup()
{
char *ssid;
char *password;
Serial.begin(9600); // Open serial communications and wait for port to open:
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.print("Initializing SD card...");
// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
// don't do anything more:
return;
}
Serial.println("card initialized.");
// open the file. note that only one file can be open at a time,so you have to close this one before opening another.
File myFile = SD.open("wifi.txt");
// if the file is available, write to it:
if (myFile) {
while (myFile.available()) {
//Serial.write(myFile.read());
wifiSSID = myFile.readStringUntil('\n'); // copie la chaine jusqu'au retour chariot
wifiPass = myFile.readStringUntil('\n');
Serveur = myFile.readStringUntil('\n');
ssid = wifiSSID.c_str();
password=wifiPass.c_str();
}
myFile.close();
}
Serial.println("");
Serial.println();
Serial.println("Boot effectué");
Serial.println("Connection Wi-Fi en cours ");
WiFi.mode(WIFI_STA);
WiFi.begin(( char)ssid), ( char)pass);
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
Serial.println("WiFi connectée");
} // fin du Setup
void loop()
{
} // fin du void loop