Hello !
I would use reasonCode() as the WiFiNINA Reference library indicates :
But when I compile the code I obtain this error :
Arduino : 1.8.10 (Windows 10), Carte : "Arduino MKR WiFi 1010"
L:\Users\LocAdmin\Documents\Arduino\sketchs\Test_WiFiNINA\Test_WiFiNINA.ino: In function 'void setup()':
Test_WiFiNINA:32:27: error: 'class WiFiClass' has no member named 'reasonCode'
Serial.println(WiFi.reasonCode());
^~~~~~~~~~
Here is my code :
/*
Test_WiFiNINA.ino
Tester le résultat donné par reasonCode avec WiFiNINA 1.40.
*/
#include <WiFiNINA.h>
const char wId[] = "SOMEONE";
const char wPwd[] = "********";
const int tempo = 3000;
const int tMax = 15000;
int status = WL_IDLE_STATUS;
WiFiClient client;
void setup() {
Serial.begin(9600);
while ( !Serial );
Serial.print("Connexion au réseau SSID (WPA) : ");
Serial.println(wId);
int attente = 0; // Temporisation de la reconnexion au WiFi
while ( status != WL_CONNECTED ) {
status = WiFi.begin(wId, wPwd);
if (status != WL_CONNECTED) {
// échec, recommencer pendant tMax secondes :
Serial.print(".");
if (attente < tMax) {
delay(tempo);
attente += tempo;
} else {
Serial.print(" Code d’erreur = ");
// using reasonCode() break the code ! Why ?
Serial.println(WiFi.reasonCode());
Serial.println("\nAbandon !") ;
exit(100);
}
}
}
Serial.println();
Serial.println("Connexion effectuée !");
Serial.println();
}
void loop() {
// Doing nothing:
;
}
Thame thing if I use client in place of WiFi.
I don't understand my error, please explain me ...
Bests regards
Luc