With the following code, I'm getting errors with both an Sparkfun Pro Micro ESP32 and Arduino Giga. With the ESP32, it doesn't connect to WiFi and the the while loop below runs continuously:
while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
}
Using a Giga, I get this error:
Failed to mount the filesystem containing the WiFi firmware.
Usually that means that the WiFi firmware has not been installed yet or was overwritten with another firmware.
The code is below:
#include <WiFi.h>
#include <Wire.h>
#include "SparkFun_STTS22H.h"
const char ssid [] = "";
const char password [] = "";
SparkFun_STTS22H mySTTS;
float temp;
int status = WL_IDLE_STATUS;
WiFiClient client;
void setup() {
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// check for the WiFi module:
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("Communication with WiFi module failed!");
// don't continue
while (true);
}
// attempt to connect to Wifi network:
while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
status = WiFi.begin(ssid, password);
// wait 3 seconds for connection:
Serial.println("status: " + status);
delay(3000);
}
Serial.println("Connected to wifi");
printWifiStatus();
}
void printWifiStatus() {
// print the SSID of the network you're attached to:
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// print your board's IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print("signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");
}
void loop() {
// put your main code here, to run repeatedly:
}
Thank you.