0

Arduino UNO WiFi Rev 2 on Adafruit IO
Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Please be positive and constructive with your questions and comments.

Arduino UNO WiFi Rev 2 on Adafruit IO

by TeleCAM on Sat Mar 20, 2021 9:23 pm

Has anyone been able to use an Arduino WiFi Rev 2 board to access Adafruit IO? I keep getting a compile error. I am using the Adafruitio_22_environmental_monitor example program in the Arduino IDE. I'm sure the problem is in the configuration of the "config.h" file, but I don't know what to change. I did get it working with a Wemos D1 Mini board without any changes to the "config.h" file.

TeleCAM
 
Posts: 4
Joined: Wed Mar 03, 2021 9:32 pm

Re: Arduino UNO WiFi Rev 2 on Adafruit IO

by brubell on Wed Mar 24, 2021 10:44 am

What compiler error are you getting - could you copy and paste it here?

Could you also upload your config.h here? please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.

brubell
 
Posts: 1319
Joined: Fri Jul 17, 2015 10:33 pm

Re: Arduino UNO WiFi Rev 2 on Adafruit IO

by TeleCAM on Wed Mar 24, 2021 11:39 am

Hi,
The compile error is:
exit status 1
'AdafruitIO_WiFi' does not name a type; did you mean 'Adafruit_I2CDevice_h'?

config.h
/************************ Adafruit IO Config *******************************/

// visit io.adafruit.com if you need to create an account,
// or if you need your Adafruit IO key.
#define IO_USERNAME ""
#define IO_KEY ""

/******************************* WIFI **************************************/

// the AdafruitIO_WiFi client will work with the following boards:
// - HUZZAH ESP8266 Breakout -> https://www.adafruit.com/products/2471
// - Feather HUZZAH ESP8266 -> https://www.adafruit.com/products/2821
// - Feather HUZZAH ESP32 -> https://www.adafruit.com/product/3405
// - Feather M0 WiFi -> https://www.adafruit.com/products/3010
// - Feather WICED -> https://www.adafruit.com/products/3056
// - Adafruit PyPortal -> https://www.adafruit.com/product/4116
// - Adafruit Metro M4 Express AirLift Lite ->
// https://www.adafruit.com/product/4000
// - Adafruit AirLift Breakout -> https://www.adafruit.com/product/4201
// - Adafruit AirLift Shield -> https://www.adafruit.com/product/4285
// - Adafruit AirLift FeatherWing -> https://www.adafruit.com/product/4264
// - WeMos D1 Mini - dgj added 02/23/21

#define WIFI_SSID ""
#define WIFI_PASS ""

// uncomment the following line if you are using airlift
// #define USE_AIRLIFT

// uncomment the following line if you are using winc1500
// #define USE_WINC1500

// comment out the following lines if you are using fona or ethernet
#include "AdafruitIO_WiFi.h"

#if defined(USE_AIRLIFT) || defined(ADAFRUIT_METRO_M4_AIRLIFT_LITE) || \
defined(ADAFRUIT_PYPORTAL)
// Configure the pins used for the ESP32 connection
#if !defined(SPIWIFI_SS) // if the wifi definition isnt in the board variant
// Don't change the names of these #define's! they match the variant ones
#define SPIWIFI SPI
#define SPIWIFI_SS 10 // Chip select pin
#define NINA_ACK 9 // a.k.a BUSY or READY pin
#define NINA_RESETN 6 // Reset pin
#define NINA_GPIO0 -1 // Not connected
#endif
AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS, SPIWIFI_SS,
NINA_ACK, NINA_RESETN, NINA_GPIO0, &SPIWIFI);
#else
AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS);
#endif
/******************************* FONA (Cellular) **************************************/

// the AdafruitIO_FONA client will work with the following boards:
// - Feather 32u4 FONA -> https://www.adafruit.com/product/3027

// uncomment the following two lines for 32u4 FONA,
// and comment out the AdafruitIO_WiFi client in the WIFI section
// #include "AdafruitIO_FONA.h"
// AdafruitIO_FONA io(IO_USERNAME, IO_KEY);

/**************************** ETHERNET (Wired) ************************************/

// the AdafruitIO_Ethernet client will work with the following boards:
// - Ethernet FeatherWing -> https://www.adafruit.com/products/3201

// uncomment the following two lines for ethernet,
// and comment out the AdafruitIO_WiFi client in the WIFI section
// #include "AdafruitIO_Ethernet.h"
// AdafruitIO_Ethernet io(IO_USERNAME, IO_KEY);

Thanks

TeleCAM
 
Posts: 4
Joined: Wed Mar 03, 2021 9:32 pm

Re: Arduino UNO WiFi Rev 2 on Adafruit IO

by brubell on Fri Mar 26, 2021 9:08 am

Uncomment the line:

Code: Select all | TOGGLE FULL SIZE
// #define USE_AIRLIFT

brubell
 
Posts: 1319
Joined: Fri Jul 17, 2015 10:33 pm

Re: Arduino UNO WiFi Rev 2 on Adafruit IO

by TeleCAM on Fri Mar 26, 2021 12:44 pm

Hi,

When I uncomment the line: " // #define USE_AIRLIFT" in config.h I get a new compile error:

exit status 1
'SPIWIFI' was not declared in this scope

When the Arduino UNO WiFi Rev 2 is used in other WiFi sketches you have to:
#include "WiFiNINA.h"

Does "AIRLIFT" replace "WiFiNINA.h" ?


Thanks

TeleCAM
 
Posts: 4
Joined: Wed Mar 03, 2021 9:32 pm

Re: Arduino UNO WiFi Rev 2 on Adafruit IO

by brubell on Mon Mar 29, 2021 10:29 am

Adafruit IO Arduino imports the wifinina library when AirLift is defined:

Here's an example config.h:
Code: Select all | TOGGLE FULL SIZE
/************************ Adafruit IO Config *******************************/

// visit io.adafruit.com if you need to create an account,
// or if you need your Adafruit IO key.
#define IO_USERNAME   "your_username"
#define IO_KEY        "your_key"

/******************************* WIFI **************************************/

// the AdafruitIO_WiFi client will work with the following boards:
//   - HUZZAH ESP8266 Breakout -> https://www.adafruit.com/products/2471
//   - Feather HUZZAH ESP8266 -> https://www.adafruit.com/products/2821
//   - Feather HUZZAH ESP32 -> https://www.adafruit.com/product/3405
//   - Feather M0 WiFi -> https://www.adafruit.com/products/3010
//   - Feather WICED -> https://www.adafruit.com/products/3056
//   - Adafruit PyPortal -> https://www.adafruit.com/product/4116
//   - Adafruit Metro M4 Express AirLift Lite -> https://www.adafruit.com/product/4000
//   - Adafruit AirLift Breakout -> https://www.adafruit.com/product/4201
//   - Adafruit AirLift Shield -> https://www.adafruit.com/product/4285
//   - Adafruit AirLift FeatherWing -> https://www.adafruit.com/product/4264
//   - Arduino Uno WiFi Rev. 2

#define WIFI_SSID   "your_ssid"
#define WIFI_PASS   "your_pass"

// uncomment the following line if you are using airlift
#define USE_AIRLIFT

// uncomment the following line if you are using winc1500
// #define USE_WINC1500

// comment out the following lines if you are using fona or ethernet
#include "AdafruitIO_WiFi.h"

#if defined(USE_AIRLIFT) || defined(ADAFRUIT_METRO_M4_AIRLIFT_LITE)
  // Configure the pins used for the ESP32 connection
  #if defined(ARDUINO_AVR_UNO_WIFI_REV2)
    // Note: Arduino Uno WiFi Rev. 2 is essentially an integrated Airlift board
    #define SPIWIFI SPI
  #endif
  #if !defined(SPIWIFI_SS) // if the wifi definition isnt in the board variant
    // Don't change the names of these #define's! they match the variant ones
    #define SPIWIFI SPI
    #define SPIWIFI_SS 10  // Chip select pin
    #define NINA_ACK 9    // a.k.a BUSY or READY pin
    #define NINA_RESETN 6 // Reset pin
    #define NINA_GPIO0 -1 // Not connected
  #endif
  AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS, SPIWIFI_SS, NINA_ACK, NINA_RESETN, NINA_GPIO0, &SPIWIFI);
#else
  AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS);
#endif
/******************************* FONA **************************************/

// the AdafruitIO_FONA client will work with the following boards:
//   - Feather 32u4 FONA -> https://www.adafruit.com/product/3027

// uncomment the following two lines for 32u4 FONA,
// and comment out the AdafruitIO_WiFi client in the WIFI section
// #include "AdafruitIO_FONA.h"
// AdafruitIO_FONA io(IO_USERNAME, IO_KEY);

/**************************** ETHERNET ************************************/

// the AdafruitIO_Ethernet client will work with the following boards:
//   - Ethernet FeatherWing -> https://www.adafruit.com/products/3201

// uncomment the following two lines for ethernet,
// and comment out the AdafruitIO_WiFi client in the WIFI section
// #include "AdafruitIO_Ethernet.h"
// AdafruitIO_Ethernet io(IO_USERNAME, IO_KEY);

brubell
 
Posts: 1319
Joined: Fri Jul 17, 2015 10:33 pm

Re: Arduino UNO WiFi Rev 2 on Adafruit IO

by TeleCAM on Mon Mar 29, 2021 11:24 am

Hi,

I tried the config.h file you sent, but still get a compile error. Error Message below:

Arduino: 1.8.13 (Windows 7), Board: "Arduino Uno WiFi Rev2, ATMEGA328"

In file included from C:\Users\Dave\Documents\Arduino\Sketchbook\libraries\Adafruit_IO_Arduino\src/AdafruitIO_WiFi.h:26:0,

from sketch\config.h:35,

from C:\Users\Dave\Documents\Arduino\Sketchbook\Adafruit_IO_LTR390_AHT10_SSD1306_UNO_WiFi_Rev2B\Adafruit_IO_LTR390_AHT10_SSD1306_UNO_WiFi_Rev2B.ino:23:

C:\Users\Dave\Documents\Arduino\Sketchbook\libraries\Adafruit_IO_Arduino\src/wifi/AdafruitIO_AIRLIFT.h: In member function 'void AdafruitIO_AIRLIFT::setLEDs(uint8_t, uint8_t, uint8_t)':

C:\Users\Dave\Documents\Arduino\Sketchbook\libraries\Adafruit_IO_Arduino\src/wifi/AdafruitIO_AIRLIFT.h:110:56: error: 'class WiFiClass' has no member named 'setLEDs'

void setLEDs(uint8_t r, uint8_t g, uint8_t b) { WiFi.setLEDs(r, g, b); }

^~~~~~~

C:\Users\Dave\Documents\Arduino\Sketchbook\libraries\Adafruit_IO_Arduino\src/wifi/AdafruitIO_AIRLIFT.h: In member function 'virtual void AdafruitIO_AIRLIFT::_connect()':

C:\Users\Dave\Documents\Arduino\Sketchbook\libraries\Adafruit_IO_Arduino\src/wifi/AdafruitIO_AIRLIFT.h:176:14: error: 'class WiFiClass' has no member named 'setPins'

WiFi.setPins(_ssPin, _ackPin, _rstPin, _gpio0Pin, _wifi);

^~~~~~~

exit status 1

Error compiling for board Arduino Uno WiFi Rev2.

TeleCAM
 
Posts: 4
Joined: Wed Mar 03, 2021 9:32 pm

Re: Arduino UNO WiFi Rev 2 on Adafruit IO

by brubell on Mon Mar 29, 2021 12:53 pm

Try using the Adafruit fork of the WiFiNINA library. Uninstall the Arduino version.

https://github.com/adafruit/WiFiNINA/

brubell
 
Posts: 1319
Joined: Fri Jul 17, 2015 10:33 pm

Please be positive and constructive with your questions and comments.