I get a WL_IDLE STATUS error when I tried uploading this:
#include "arduino_secrets.h"
#include
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = SECRET_SSID; // your network SSID (name)
char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP)
int status = WL_IDLE_STATUS; // the Wifi radio's status
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial);
// attempt to connect to Wifi network:
while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to network: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network:
status = WiFi.begin(ssid, pass);
// wait 10 seconds for connection:
delay(10000);
}
// you're connected now, so print out the data:
Serial.println("You're connected to the network");
MKR_1010_Tutorial_2:7:14: error: 'WL_IDLE_STATUS' was not declared in this scope
7 | int status = WL_IDLE_STATUS; // the Wifi radio's status
| ^~~~~~~~~~~~~~
/tmp/arduino_modified_sketch_977706/MKR_1010_Tutorial_2.ino: In function 'void setup()':
MKR_1010_Tutorial_2:15:20: error: 'WL_CONNECTED' was not declared in this scope
15 | while (status != WL_CONNECTED) {
| ^~~~~~~~~~~~
MKR_1010_Tutorial_2:19:14: error: 'WiFi' was not declared in this scope
19 | status = WiFi.begin(ssid, pass);
| ^~~~
/tmp/arduino_modified_sketch_977706/MKR_1010_Tutorial_2.ino: In function 'void printData()':
MKR_1010_Tutorial_2:43:18: error: 'WiFi' was not declared in this scope
43 | IPAddress ip = WiFi.localIP();
| ^~~~
exit status 1
'WL_IDLE_STATUS' was not declared in this scope
ok, that worked, sketch uploaded, but now it repeats Attempting to Connect to my Wireless Network and for some reason its not connecting, the username and password is correct, so maybe its the code or the wifi signal for this board is weak
/tmp/arduino_modified_sketch_321476/sketch_sep12a.ino: In function 'void setup()':
/tmp/arduino_modified_sketch_321476/sketch_sep12a.ino:10:14: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
10 | WiFi.begin("Network Name", "password");
| ^~~~~~~~~~~~~~~~~
/arduino-1.8.12/libraries/WiFi/src/utility/wifi_drv.cpp: In static member function 'static uint8_t WiFiDrv::getEncTypeNetowrks(uint8_t)':
/arduino-1.8.12/libraries/WiFi/src/utility/wifi_drv.cpp:451:10: warning: converting to non-pointer type 'uint8_t' {aka 'unsigned char'} from NULL [-Wconversion-null]
451 | return NULL;
| ^~~~
/arduino-1.8.12/libraries/WiFi/src/utility/wifi_drv.cpp: In static member function 'static int32_t WiFiDrv::getRSSINetoworks(uint8_t)':
/arduino-1.8.12/libraries/WiFi/src/utility/wifi_drv.cpp:476:10: warning: converting to non-pointer type 'int32_t' {aka 'long int'} from NULL [-Wconversion-null]
476 | return NULL;
| ^~~~
Sketch uses 61192 bytes (0%) of program storage space. Maximum is 16773120 bytes.
Global variables use 11524 bytes (4%) of dynamic memory, leaving 250620 bytes for local variables. Maximum is 262144 bytes.
Resetting /dev/ttyACM0
Converting to uf2, output size: 136192, start address: 0x2000
No drive to deploy.
An error occurred while uploading the sketch
This is wrong. The Wi-Fi library for the Nano RP2040 Connect is the WIFININA library. What is not obvious due to @bluebit87 having posted their code incorrectly is that they already have an #include directive for WiFiNINA.h:
No additional #include directives should be necessary to compile this sketch. The #include for WiFi.h causes the WiFi library to be compiled:
This is the library for the long retired Arduino WiFi Shield. The only reason you should ever use this library on the Nano RP2040 Connect is if for some reason you have an Arduino WiFi Shield connected to the board, which nobody will ever do.
@bluebit87 after you have removed the #include <WiFi.h>, please do this:
Select Sketch > Verify/Compile from the Arduino IDE's menus.
After the compilation fails you'll see a button on the right side of the orange bar in the Arduino IDE: Copy error messages. Click that button.
Open a forum reply here by clicking the Reply button.
Click the </> icon on the post composer toolbar. This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
I am experiencing the same error with all the wifinina examples. Error messages:
Arduino: 1.8.15 (Linux), TD: 1.54, Board: "Arduino Nano RP2040 Connect, 16MB (no FS), 125 MHz, Disabled, None, Pico SDK"
AP_SimpleWebServer:28:14: error: 'WL_IDLE_STATUS' was not declared in this scope
28 | int status = WL_IDLE_STATUS;
| ^~~~~~~~~~~~~~
AP_SimpleWebServer:29:1: error: 'WiFiServer' does not name a type
29 | WiFiServer server(80);
| ^~~~~~~~~~
/home/jearlam/Arduino/libraries/WiFiNINA/examples/AP_SimpleWebServer/AP_SimpleWebServer.ino: In function 'void setup()':
AP_SimpleWebServer:43:7: error: 'WiFi' was not declared in this scope
43 | if (WiFi.status() == WL_NO_MODULE) {
| ^~~~
AP_SimpleWebServer:43:24: error: 'WL_NO_MODULE' was not declared in this scope
43 | if (WiFi.status() == WL_NO_MODULE) {
| ^~~~~~~~~~~~
AP_SimpleWebServer:49:15: error: 'WiFi' was not declared in this scope
49 | String fv = WiFi.firmwareVersion();
| ^~~~
AP_SimpleWebServer:50:12: error: 'WIFI_FIRMWARE_LATEST_VERSION' was not declared in this scope
50 | if (fv < WIFI_FIRMWARE_LATEST_VERSION) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
AP_SimpleWebServer:64:17: error: 'WL_AP_LISTENING' was not declared in this scope
64 | if (status != WL_AP_LISTENING) {
| ^~~~~~~~~~~~~~~
AP_SimpleWebServer:74:3: error: 'server' was not declared in this scope
74 | server.begin();
| ^~~~~~
/home/jearlam/Arduino/libraries/WiFiNINA/examples/AP_SimpleWebServer/AP_SimpleWebServer.ino: In function 'void loop()':
AP_SimpleWebServer:83:17: error: 'WiFi' was not declared in this scope
83 | if (status != WiFi.status()) {
| ^~~~
AP_SimpleWebServer:87:19: error: 'WL_AP_CONNECTED' was not declared in this scope
87 | if (status == WL_AP_CONNECTED) {
| ^~~~~~~~~~~~~~~
AP_SimpleWebServer:96:3: error: 'WiFiClient' was not declared in this scope
96 | WiFiClient client = server.available(); // listen for incoming clients
| ^~~~~~~~~~
AP_SimpleWebServer:98:7: error: 'client' was not declared in this scope
98 | if (client) { // if you get a client,
| ^~~~~~
/home/jearlam/Arduino/libraries/WiFiNINA/examples/AP_SimpleWebServer/AP_SimpleWebServer.ino: In function 'void printWiFiStatus()':
AP_SimpleWebServer:152:18: error: 'WiFi' was not declared in this scope
152 | Serial.println(WiFi.SSID());
| ^~~~
exit status 1
'WL_IDLE_STATUS' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Update: it now compiles, having selected a different Arduino Nano RP2040 Connect in the boards manager. There are multiple options with the same name in different sections, some which work and some which don't. The working one is the "Arduino MBED OS RP2040 boards -> Arduino Nano RP Connect" option, I had "Raspberry Pi RP2040 Boards (1.9.4) -> Arduino Nano RP Connect" selected.
I think you must mean "Arduino Mbed OS Nano Boards -> Arduino Nano RP2040 Connect". The "Arduino Mbed OS Boards" platform only contains the "Raspberry Pi Pico" board.
That is a 3rd party boards platform which also provides support for the Arduino Nano RP2040 Connect board, but with a different style of core library.