Arduino UNO WiFi Rev 2 to Blynk

Hi, I’ve been trying to use Arduino UNO Wifi Rev2 with Blynk.
I’ve seen other threads on here about this and have tried their code but I’m getting large error messages. Can someone tell me where to look please?
It looks like a problem with SPI.h???

Code:


#define BLYNK_PRINT Serial
#include <SPI.h>
#include <WiFiNINA.h>
#include <BlynkSimpleWiFiNINA.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "6**************************e";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "iPhone von M*****";
char pass[] = "g*************";
//char ssid[] = "G*************";
//char pass[] = "m***********";
void setup()
{
  // Debug console
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
}
// This function will be called every time Slider Widget
// in Blynk app writes values to the Virtual Pin 1
BLYNK_WRITE(V1)
{
  int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
  // You can also use:
  // String i = param.asStr();
  // double d = param.asDouble();
  Serial.print("V1 Slider value is: ");
  Serial.println(pinValue);
}

void loop()
{
  Blynk.run();
}

Error messages:

C:\Users\mwclubb04\Documents\Arduino\libraries\WiFiNINA\src\utility\spi_drv.cpp: In static member function ‘static void SpiDrv::begin()’:

C:\Users\mwclubb04\Documents\Arduino\libraries\WiFiNINA\src\utility\spi_drv.cpp:87:24: error: ‘PINS_COUNT’ was not declared in this scope

   if (SLAVERESET > PINS_COUNT) {

                    ^~~~~~~~~~

C:\Users\mwclubb04\Documents\Arduino\libraries\WiFiNINA\src\utility\spi_drv.cpp:87:24: note: suggested alternative: ‘PING_CMD’

   if (SLAVERESET > PINS_COUNT) {

                    ^~~~~~~~~~

                    PING_CMD

C:\Users\mwclubb04\Documents\Arduino\libraries\WiFiNINA\src\utility\spi_drv.cpp:97:15: error: ‘NINA_GPIO0’ was not declared in this scope

   pinMode(NINA_GPIO0, OUTPUT);

           ^~~~~~~~~~

C:\Users\mwclubb04\Documents\Arduino\libraries\WiFiNINA\src\utility\spi_drv.cpp: In static member function ‘static int SpiDrv::available()’:

C:\Users\mwclubb04\Documents\Arduino\libraries\WiFiNINA\src\utility\spi_drv.cpp:565:25: error: ‘NINA_GPIO0’ was not declared in this scope

 return (digitalRead(NINA_GPIO0) != LOW);

                     ^~~~~~~~~~

exit status 1
Error compiling for board Arduino Uno WiFi.

Thanks

Remember to install the Arduino IDE Boards Manager to install Arduino megaAVR Boards package, then select Tools->Boards->Arduino UNO WiFi Rev2

then use these modified libraries

  1. WiFiNINA_Generic for normal WiFi applications.

To install

arduino-library-badge

  1. Blynk_WiFiNINA_WM for Blynk-related applications.

To install

arduino-library-badge

Try the following examples

  1. WiFiWebServer without Blynk

  2. UNO_WiFiNINA with Blynk

If the WiFiWebServer example doesn’t work, it’s possible that the pin assignment in the library is different from actual ones.

The example UNO_WiFiNINA

// To install WiFiNINA_Generic library (https://github.com/khoih-prog/WiFiNINA_Generic)
// and Blynk_WiFiNINA_WM  (https://github.com/khoih-prog/Blynk_WiFiNINA_WM)

#include <BlynkSimpleWiFiNINA_UNO_WiFi.h>
//#include <BlynkSimpleWiFiNINA_UNO_WiFi_WM_Small.h>

#define USE_LOCAL_SERVER      true

#if USE_LOCAL_SERVER

char auth[] = "****";
String BlynkServer = "account.duckdns.org";
//String BlynkServer = "192.168.2.112";

#else

char auth[] = "****";
String BlynkServer = "blynk-cloud.com";

#endif

#define BLYNK_SERVER_HARDWARE_PORT    8080

// Your WiFi credentials.
char ssid[] = "****";
char pass[] = "****";

void heartBeatPrint(void)
{
  static int num = 1;

  if (Blynk.connected())
  {
    Serial.print("B");
  }
  else
  {
    Serial.print("F");
  }

  if (num == 80)
  {
    Serial.println();
    num = 1;
  }
  else if (num++ % 10 == 0)
  {
    Serial.print(" ");
  }
}

void check_status()
{
  static unsigned long checkstatus_timeout = 0;

#define STATUS_CHECK_INTERVAL     15000L

  // Send status report every STATUS_REPORT_INTERVAL (60) seconds: we don't need to send updates frequently if there is no status change.
  if ((millis() > checkstatus_timeout) || (checkstatus_timeout == 0))
  {
    // report status to Blynk
    heartBeatPrint();

    checkstatus_timeout = millis() + STATUS_CHECK_INTERVAL;
  }
}

void setup()
{
  // Debug console
  Serial.begin(115200);
  while (!Serial);
  //delay(1000);

  Serial.println("\nStart UNO_WiFiNINA using WiFiNINA_Shield on UNO WiFi");

#if USE_LOCAL_SERVER
  Blynk.begin(auth, ssid, pass, BlynkServer.c_str(), BLYNK_SERVER_HARDWARE_PORT);
#else
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
  Blynk.begin(auth, ssid, pass);
#endif
}

void loop()
{
  Blynk.run();
  check_status();
}

Compile result

Sketch uses 19154 bytes (39%) of program storage space. Maximum is 48640 bytes.
Global variables use 420 bytes (6%) of dynamic memory, leaving 5724 bytes for local variables. Maximum is 6144 bytes.