Several example sketches fail

The example sketch scan networks fails on NANO R4, it works on UNO R4
Here is the code

/*
  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.println("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();
}

Here are the errors

FQBN: arduino:renesas_uno:nanor4
Using board 'nanor4' from platform in folder: /Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1
Using core 'arduino' from platform in folder: /Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1

Detecting libraries used...
/Users/ronalexander/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-g++ -c -w -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -nostdlib -DF_CPU=48000000 -DARDUINO_NANO_R4 -DARDUINO_UNOR4_MINIMA -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -w -x c++ -E -CC -DARDUINO=10607 -DPROJECT_NAME="/Users/ronalexander/Library/Caches/arduino/sketches/AB6184A5AFE2826AEF76471B0305AE60/ScanNetworks.ino" -DARDUINO_nanor4 -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE=700 -mthumb @/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/variants/NANOR4/defines.txt -DCFG_TUSB_MCU=OPT_MCU_RAXXX -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino/tinyusb -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino/api/deprecated -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino/api/deprecated-avr-comp -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/variants/NANOR4 -iprefix/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1 @/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/variants/NANOR4/includes.txt /Users/ronalexander/Library/Caches/arduino/sketches/AB6184A5AFE2826AEF76471B0305AE60/sketch/ScanNetworks.ino.cpp -o /dev/null
Alternatives for WiFiS3.h: [WiFiS3@0.0.0]
ResolveLibrary(WiFiS3.h)
  -> candidates: [WiFiS3@0.0.0]
/Users/ronalexander/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-g++ -c -w -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -nostdlib -DF_CPU=48000000 -DARDUINO_NANO_R4 -DARDUINO_UNOR4_MINIMA -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -w -x c++ -E -CC -DARDUINO=10607 -DPROJECT_NAME="/Users/ronalexander/Library/Caches/arduino/sketches/AB6184A5AFE2826AEF76471B0305AE60/ScanNetworks.ino" -DARDUINO_nanor4 -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE=700 -mthumb @/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/variants/NANOR4/defines.txt -DCFG_TUSB_MCU=OPT_MCU_RAXXX -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino/tinyusb -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino/api/deprecated -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino/api/deprecated-avr-comp -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/variants/NANOR4 -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/libraries/WiFiS3/src -iprefix/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1 @/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/variants/NANOR4/includes.txt /Users/ronalexander/Library/Caches/arduino/sketches/AB6184A5AFE2826AEF76471B0305AE60/sketch/ScanNetworks.ino.cpp -o /dev/null
/Users/ronalexander/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-g++ -c -w -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -nostdlib -DF_CPU=48000000 -DARDUINO_NANO_R4 -DARDUINO_UNOR4_MINIMA -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -w -x c++ -E -CC -DARDUINO=10607 -DPROJECT_NAME="/Users/ronalexander/Library/Caches/arduino/sketches/AB6184A5AFE2826AEF76471B0305AE60/ScanNetworks.ino" -DARDUINO_nanor4 -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE=700 -mthumb @/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/variants/NANOR4/defines.txt -DCFG_TUSB_MCU=OPT_MCU_RAXXX -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino/tinyusb -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino/api/deprecated -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino/api/deprecated-avr-comp -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/variants/NANOR4 -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/libraries/WiFiS3/src -iprefix/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1 @/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/variants/NANOR4/includes.txt /Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/libraries/WiFiS3/src/Modem.cpp -o /dev/null
Using cached library dependencies for file: /Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/libraries/WiFiS3/src/StringHelpers.cpp
Using cached library dependencies for file: /Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/libraries/WiFiS3/src/WiFi.cpp
Using cached library dependencies for file: /Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/libraries/WiFiS3/src/WiFiClient.cpp
Using cached library dependencies for file: /Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/libraries/WiFiS3/src/WiFiFileSystem.cpp
Using cached library dependencies for file: /Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/libraries/WiFiS3/src/WiFiSSLClient.cpp
Using cached library dependencies for file: /Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/libraries/WiFiS3/src/WiFiServer.cpp
Using cached library dependencies for file: /Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/libraries/WiFiS3/src/WiFiUdp.cpp
Generating function prototypes...
/Users/ronalexander/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-g++ -c -w -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -nostdlib -DF_CPU=48000000 -DARDUINO_NANO_R4 -DARDUINO_UNOR4_MINIMA -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -w -x c++ -E -CC -DARDUINO=10607 -DPROJECT_NAME="/Users/ronalexander/Library/Caches/arduino/sketches/AB6184A5AFE2826AEF76471B0305AE60/ScanNetworks.ino" -DARDUINO_nanor4 -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE=700 -mthumb @/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/variants/NANOR4/defines.txt -DCFG_TUSB_MCU=OPT_MCU_RAXXX -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino/tinyusb -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino/api/deprecated -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino/api/deprecated-avr-comp -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/variants/NANOR4 -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/libraries/WiFiS3/src -iprefix/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1 @/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/variants/NANOR4/includes.txt /Users/ronalexander/Library/Caches/arduino/sketches/AB6184A5AFE2826AEF76471B0305AE60/sketch/ScanNetworks.ino.cpp -o /private/var/folders/r5/fjhtttf952x9mvr0j_pdkt9h0000gn/T/2434236282/sketch_merged.cpp
/Users/ronalexander/Library/Arduino15/packages/builtin/tools/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /private/var/folders/r5/fjhtttf952x9mvr0j_pdkt9h0000gn/T/2434236282/sketch_merged.cpp

Compiling sketch...
/Users/ronalexander/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-g++ -c -w -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -MMD -nostdlib -DF_CPU=48000000 -DARDUINO_NANO_R4 -DARDUINO_UNOR4_MINIMA -MMD -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -DARDUINO=10607 "-DPROJECT_NAME=\"/Users/ronalexander/Library/Caches/arduino/sketches/AB6184A5AFE2826AEF76471B0305AE60/ScanNetworks.ino\"" -DARDUINO_nanor4 -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE=700 -mthumb @/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/variants/NANOR4/defines.txt -DCFG_TUSB_MCU=OPT_MCU_RAXXX -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino/tinyusb -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino/api/deprecated -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino/api/deprecated-avr-comp -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/variants/NANOR4 -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/libraries/WiFiS3/src -iprefix/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1 @/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/variants/NANOR4/includes.txt /Users/ronalexander/Library/Caches/arduino/sketches/AB6184A5AFE2826AEF76471B0305AE60/sketch/ScanNetworks.ino.cpp -o /Users/ronalexander/Library/Caches/arduino/sketches/AB6184A5AFE2826AEF76471B0305AE60/sketch/ScanNetworks.ino.cpp.o
Compiling libraries...
Compiling library "WiFiS3"
/Users/ronalexander/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-g++ -c -w -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -MMD -nostdlib -DF_CPU=48000000 -DARDUINO_NANO_R4 -DARDUINO_UNOR4_MINIMA -MMD -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -DARDUINO=10607 "-DPROJECT_NAME=\"/Users/ronalexander/Library/Caches/arduino/sketches/AB6184A5AFE2826AEF76471B0305AE60/ScanNetworks.ino\"" -DARDUINO_nanor4 -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE=700 -mthumb @/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/variants/NANOR4/defines.txt -DCFG_TUSB_MCU=OPT_MCU_RAXXX -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino/tinyusb -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino/api/deprecated -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino/api/deprecated-avr-comp -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/cores/arduino -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/variants/NANOR4 -I/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/libraries/WiFiS3/src -iprefix/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1 @/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/variants/NANOR4/includes.txt /Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/libraries/WiFiS3/src/Modem.cpp -o /Users/ronalexander/Library/Caches/arduino/sketches/AB6184A5AFE2826AEF76471B0305AE60/libraries/WiFiS3/Modem.cpp.o
Using previously compiled file: /Users/ronalexander/Library/Caches/arduino/sketches/AB6184A5AFE2826AEF76471B0305AE60/libraries/WiFiS3/StringHelpers.cpp.o
Using previously compiled file: /Users/ronalexander/Library/Caches/arduino/sketches/AB6184A5AFE2826AEF76471B0305AE60/libraries/WiFiS3/WiFiUdp.cpp.o
Using previously compiled file: /Users/ronalexander/Library/Caches/arduino/sketches/AB6184A5AFE2826AEF76471B0305AE60/libraries/WiFiS3/WiFi.cpp.o
Using previously compiled file: /Users/ronalexander/Library/Caches/arduino/sketches/AB6184A5AFE2826AEF76471B0305AE60/libraries/WiFiS3/WiFiSSLClient.cpp.o
Using previously compiled file: /Users/ronalexander/Library/Caches/arduino/sketches/AB6184A5AFE2826AEF76471B0305AE60/libraries/WiFiS3/WiFiFileSystem.cpp.o
Using previously compiled file: /Users/ronalexander/Library/Caches/arduino/sketches/AB6184A5AFE2826AEF76471B0305AE60/libraries/WiFiS3/WiFiClient.cpp.o
Using previously compiled file: /Users/ronalexander/Library/Caches/arduino/sketches/AB6184A5AFE2826AEF76471B0305AE60/libraries/WiFiS3/WiFiServer.cpp.o
/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/libraries/WiFiS3/src/Modem.cpp:426:34: error: 'D24' was not declared in this scope
    ModemClass modem = ModemClass(D24,D25);
                                  ^~~
/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/libraries/WiFiS3/src/Modem.cpp:426:34: note: suggested alternative: 'D14'
    ModemClass modem = ModemClass(D24,D25);
                                  ^~~
                                  D14
/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/libraries/WiFiS3/src/Modem.cpp:426:38: error: 'D25' was not declared in this scope
    ModemClass modem = ModemClass(D24,D25);
                                      ^~~
/Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/libraries/WiFiS3/src/Modem.cpp:426:38: note: suggested alternative: 'D15'
    ModemClass modem = ModemClass(D24,D25);
                                      ^~~
                                      D15
Using library WiFiS3 at version 0.0.0 in folder: /Users/ronalexander/Library/Arduino15/packages/arduino/hardware/renesas_uno/1.5.1/libraries/WiFiS3 
exit status 1

Compilation error: exit status 1

I didn't think that the Nano R4 had WiFi?
Its more like the UNO R4 Minima.

1 Like

Well, that would explain it. I just assumed all NANOs had wifi. So I bought a bunch for no good reason.

Then why are there board specific examples and



And the core files look lke there should be wifi

I am not saying you are wrong, but it's dam confusing!

Hi @sonofcy.

These are not actually board-specific. They are platform-specific. They are all the example sketches of the libraries bundled with the "Arduino UNO R4 Boards" platform. In addition to the Nano R4, that platform provides support for the UNO R4 WiFi board. For this reason, the "WiFiS3" library is bundled with the platform, and so that library's examples are shown in the File > Examples menu when any board of the "Arduino UNO R4 Boards" platform is selected in Arduino IDE.

So the "Examples for Arduino Nano R4" heading in the menu is misleading. I have made a proposal for changing this to an appropriate description of the examples:


There is also a proposal for making it possible for compatibility to be specified to a board level granularity in library metadata here:

If that compatibility information was available, it could be used by Arduino IDE to filter and tailor the content of the "Examples" menu.

As with the examples, the reason is that the "Arduino UNO R4 Boards" platform provides support for the UNO R4 WiFi board. For this reason, it contains files related to Wi-Fi and that board.

1 Like

Thank you for the explanation, I don't feel quite so stupid now.

I must admit that I also thought that the examples were board specific, so thank you @ptillisch for the explanation.

At one time one could more readily align the board name with a specific MCU - UNO/Nano=328P, Leonardo/Micro=32u4, Mega=2560 etc, none of the official Arduino boards had WiFi capability and to add WiFi one had to add a separate ESP8266 or ESP32 module, so this situation never arose. But as things have moved on, we have seen a proliferation of newer boards that now include onboard WiFi modules (Nano ESP32, Nano Connect, UNO WiFi Rev2, UNO R4 Wifi, Gigi Wifi etc) and that's without mentioning third party versions. Boards that have an onboard ESP32 have, in effect, two MCUs. We now also have versions of the same board with and without WiFi. The picture has become a little more complex. The board packages evidently remain categorized by their core MCU platform which is fair enough as the included WiFi module is a peripheral. It is also understandable to include of all examples - including the WiFiS3 related ones - pertaining to the platform, within the package. However, is there no way, for the purposes of clarity, to filter out and not show WiFi examples when a the board that has been selected does not have WiFi capability? Is there no #define value or some tag in the board definition within boards.txt that could be used to determine this? I think that would be useful to avoid this kind of confusion and address the increasing number of permutations.

The "Arduino Mbed OS Nano Boards" platform provides support for the Nordic nRF52840-based Nano 33 BLE boards and the Raspberry Pi RP2040-based Nano RP2040 Connect.

And if you look at the "Arduino Mbed OS Boards" platform as a whole, the diversity of targets is even more diverse.

The same applies to the new Zephyr OS-based platform.

The "Teensy" platform supports the modern NXP-based boards as well as the older AVR-based boards.

Even though the "esp32" platform only supports microcontrollers of the "ESP32" family, there are actually very significant differences between the targets, to the point of even needing different toolchains.

Not in this context where we are talking about Arduino IDE populating the File > Examples menu.

In my previous reply, I mentioned that there is a proposal for allowing library compatibility to be specified via the library metadata to a board-level granularity. But there isn't anything like that currently.

Note that Arduino IDE doesn't have any understanding of the core, library, and sketch code when populating the menu. It only has the information provided by the platform configuration and library metadata.

Well, boards.txt defines a unique machine identifier for the board. This is probably all that is needed from the platform. That identifier can then be used in compatibility/incompatibility lists in the library metadata.

Of course, you could go further by taking the approach of instead defining arbitrary attributes of the board (e.g., wifi-s3, hid) in the platform's board definition and then specifying the required attributes in sketch metadata. However, this would be more difficult to implement since it requires coordination between the platform and sketch developers, whereas the current proposal doesn't require any work in the platforms.