I am in the process of trying to send an email using my Arduino WiFi Rev2, I added the google.com and gmail.com domains to the SSL root certificates because the previous errors I would get would be that it could not connect to the server. Once I run the FirmwareUpdater and upload the certificates, it stops being able to connect to the WiFi and never breaks out of this loop.
while(wifi_status != WL_CONNECTED){ // Checks infinitely for connection until one is reached then breaks out of the loop
Serial.print("Connecting to SSID: "); Serial.println(ssid);
wifi_status = WiFi.begin(ssid, pass);
delay(10000); // Delays for 10 seconds
if(wifi_status != WL_CONNECTED){
Serial.println("Incorrect SSID or password"); // Returns message if SSID or password is wrong
}
}
Serial.println("Network Connection Established"); // Gotten through loop meaning it is connected
Code I was using to send an email using the EMailSender library that produced an error before adding SSL root certificates.
What value does it have after this? wifi_status = WiFi.begin(ssid, pass);
What happens if you use File -> Examples -> RETIRED -> WiFi -> ConnectWithWPA and put in your SSID and Password? Does it connect successfully? If not, maybe you are using the wrong WiFi library for your hardware.
After modifying the code, shown below, to print the value of wifi_status to the serial monitor it displays a value of 4 after printing the SSID.
while(wifi_status != WL_CONNECTED){ // Checks infinitely for connection until one is reached then breaks out of the loop
Serial.print("Connecting to SSID: "); Serial.println(ssid);
wifi_status = WiFi.begin(ssid, pass);
Serial.println(wifi_status);
delay(10000); // Delays for 10 seconds
if(wifi_status != WL_CONNECTED){
Serial.println("Incorrect SSID or password"); // Returns message if SSID or password is wrong
}
}
Serial.println("Network Connection Established"); // Gotten through loop meaning it is connected
When I upload the ConnectWithWPA file after adding my SSID and password nothing prints to the serial monitor.
That seems to mean that it couldn't establish a connection.
Is your Serial Monitor set to 9600 baud? Did you try pressing Reset? If you don't get the "WiFi shield not present" error then you should get at least one "Attempting to connect to WPA SSID: " message.
Weird... There is a WiFi.init() function that calls WiFiDrv::wifiDriverInit() which calls SpiDrv::begin() which calls SPI.begin() but nobody seems to call WiFi.init()!
Yes, it is set to 9600 baud, I also tried pressing Reset. Trying the ConnectWithWPA file in Files -> Examples -> WiFiNINA -> ConnectWithWPA ended up working and connecting to the WiFi. I try putting WiFi.init() in my setup and it returns. I should add I am currently using the WiFiNINA library.
Email_Test:36:8: error: 'static void WiFiClass::init()' is private within this context
WiFi.init();
^~~~
Serial.begin(9600);
while(!Serial){
;
}
WiFi.init();
//Connecting to WiFi Code. Can be commented out if not needed or else it will not get to the code
while(wifi_status != WL_CONNECTED){ // Checks infinitely for connection until one is reached then breaks out of the loop
Serial.print("Connecting to SSID: "); Serial.println(ssid);
wifi_status = WiFi.begin(ssid, pass);
Serial.println(wifi_status);
delay(10000); // Delays for 10 seconds
if(wifi_status != WL_CONNECTED){
Serial.println("Incorrect SSID or password"); // Returns message if SSID or password is wrong
}
}
Serial.println("Network Connection Established"); // Gotten through loop meaning it is connected