Hello, I uploaded the WiFiS3 example "ScanNetworks" to my Arduino UNO R4 WIFi with the Arduino Web Editor on my chromebook and it does not say anything in the serial monitor. Can someone help me?
My code is:
/*
This example prints the board's MAC address, and
scans for available WiFi networks using the NINA module.
Every ten seconds, it scans again. It doesn't actually
connect to any network, so no encryption scheme is specified.
Circuit:
* Uno R4 WiFi
created 13 July 2010
by dlf (Metodo2 srl)
modified 21 Junn 2012
by Tom Igoe and Jaymes Dec
Find the full UNO R4 WiFi Network documentation here:
https://docs.arduino.cc/tutorials/uno-r4-wifi/wifi-examples#scan-networks
*/
#include <WiFiS3.h>
void setup() {
//Initialize serial and wait for port to open:
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_MODULE) {
Serial.println("Communication with WiFi module failed!");
// don't continue
while (true);
}
String fv = WiFi.firmwareVersion();
if (fv < WIFI_FIRMWARE_LATEST_VERSION) {
Serial.println("Please upgrade the firmware");
}
}
void loop() {
byte mac[6];
// scan for existing networks:
Serial.println("Scanning available networks...");
listNetworks();
WiFi.macAddress(mac);
Serial.println();
Serial.print("Your MAC Address is: ");
printMacAddress(mac);
delay(10000);
}
void listNetworks() {
// scan for nearby networks:
Serial.println("** Scan Networks **");
int numSsid = WiFi.scanNetworks();
if (numSsid == -1) {
Serial.println("Couldn't get a WiFi connection");
while (true);
}
// print the list of networks seen:
Serial.print("number of available networks:");
Serial.println(numSsid);
// print the network number and name for each network found:
for (int thisNet = 0; thisNet < numSsid; thisNet++) {
Serial.print(thisNet);
Serial.print(") ");
Serial.print(WiFi.SSID(thisNet));
Serial.print(" Signal: ");
Serial.print(WiFi.RSSI(thisNet));
Serial.print(" dBm");
Serial.print(" Encryption: ");
printEncryptionType(WiFi.encryptionType(thisNet));
}
}
void printEncryptionType(int thisType) {
// read the encryption type and print out the name:
switch (thisType) {
case ENC_TYPE_WEP:
Serial.println("WEP");
break;
case ENC_TYPE_WPA:
Serial.println("WPA");
break;
case ENC_TYPE_WPA2:
Serial.println("WPA2");
break;
case ENC_TYPE_WPA3:
Serial.print("WPA3");
break;
case ENC_TYPE_NONE:
Serial.println("None");
break;
case ENC_TYPE_AUTO:
Serial.println("Auto");
break;
case ENC_TYPE_UNKNOWN:
default:
Serial.println("Unknown");
break;
}
}
void printMacAddress(byte mac[]) {
for (int i = 0; i < 6; i++) {
if (i > 0) {
Serial.print(":");
}
if (mac[i] < 16) {
Serial.print("0");
}
Serial.print(mac[i], HEX);
}
Serial.println();
}
I'm sorry I can't use the code format because I use the Web Editor and I can't copy it in code format.
Thank you in advance !
Edits by sterretje