need help: Adafruit IO from Matrix Portal

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.
Locked
User avatar
hatchethead
 
Posts: 20
Joined: Mon Dec 12, 2016 9:11 pm

need help: Adafruit IO from Matrix Portal

Post by hatchethead »

I'm need troubleshooting help (newbie problem) getting a Matrix Portal M4 (SAMDI51) with ESP32 WiFi co-processor to connect to Adafruit IO. I'm getting a compile error I can't figure out.

First, context.

I've built the RGB Matrix Portal Room CO2 Monitor project (https://learn.adafruit.com/matrix-porta ... o2-monitor) and it works great, but I want to add logging of the data. The easiest way to do this seems to be through Adafruit IO. I'm trying to closely follow the basic instructions for getting started with this. (See https://learn.adafruit.com/adafruit-io- ... uino-setup.)

Before writing anything else, I have the Matrix Portal connected to my computer (Mac) with a good data USB cable, and the board is mounted to my filesystem as 'CIRCUITPY'.

Using the Library Manager in the Processing IDE, I've downloaded the Adafruit IO libraries. I opened the example file for adafruitIO_06_digital_in, getting a main file (?) and a config.h file. I modified the latter with my Adafruit username and key and my SSID information.

When I compile I get an error. Verbose output below, non-error content snipped out.

Code: Select all

Arduino: 1.8.16 (Mac OS X), Board: "Adafruit Matrix Portal M4 (SAMD51), Enabled, 120 MHz (standard), Small (-Os) (standard), 50 MHz (standard), Arduino, On"

[snip]

In file included from /Users/jason.miller/Documents/Arduino/adafruitio_06_digital_in/adafruitio_06_digital_in.ino:19:
config.h:49:1: error: 'AdafruitIO_WiFi' does not name a type
   49 | AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS);
      | ^~~~~~~~~~~~~~~
adafruitio_06_digital_in:31:1: error: 'AdafruitIO_Feed' does not name a type
   31 | AdafruitIO_Feed *digital = io.feed("digital");
      | ^~~~~~~~~~~~~~~
/Users/jason.miller/Documents/Arduino/adafruitio_06_digital_in/adafruitio_06_digital_in.ino: In function 'void setup()':
adafruitio_06_digital_in:46:3: error: 'io' was not declared in this scope
   46 |   io.connect();
      |   ^~
adafruitio_06_digital_in:49:23: error: 'AIO_CONNECTED' was not declared in this scope
   49 |   while(io.status() < AIO_CONNECTED) {
      |                       ^~~~~~~~~~~~~
/Users/jason.miller/Documents/Arduino/adafruitio_06_digital_in/adafruitio_06_digital_in.ino: In function 'void loop()':
adafruitio_06_digital_in:66:3: error: 'io' was not declared in this scope
   66 |   io.run();
      |   ^~
adafruitio_06_digital_in:83:3: error: 'digital' was not declared in this scope; did you mean 'isdigit_l'?
   83 |   digital->save(current);
      |   ^~~~~~~
      |   isdigit_l
Using library Adafruit_IO_Arduino at version 4.1.1 in folder: /Users/jason.miller/Documents/Arduino/libraries/Adafruit_IO_Arduino 
Using library Adafruit_MQTT_Library at version 2.4.2 in folder: /Users/jason.miller/Documents/Arduino/libraries/Adafruit_MQTT_Library 
Using library ArduinoHttpClient at version 0.4.0 in folder: /Users/jason.miller/Documents/Arduino/libraries/ArduinoHttpClient 
exit status 1
'AdafruitIO_WiFi' does not name a type
I saw a post (viewtopic.php?f=56&t=182741) in the Adafruit Forum suggesting that the Matrix Portal should use the Airlift framework. When I commented 'in' the appropriate line of config.h, compilation just threw a ton of other errors suggesting Airlift is not the way to go.

Can anyone point me to instructions for how to have the Matrix Portal talk with Adafruit IT, or point me to examples that include this functionality with a Matrix Portal? Thanks in advance.

User avatar
brubell
Learn User Page
 
Posts: 2010
Joined: Fri Jul 17, 2015 10:33 pm

Re: need help: Adafruit IO from Matrix Portal

Post by brubell »

Could you please post your `config.h` file? Please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.

User avatar
hatchethead
 
Posts: 20
Joined: Mon Dec 12, 2016 9:11 pm

Re: need help: Adafruit IO from Matrix Portal

Post by hatchethead »

This is my config.h file, as requested.

Code: Select all

/************************ 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 "hatchethead"
#define IO_KEY "SNIP"

/******************************* 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

#define WIFI_SSID "SNIP"
#define WIFI_PASS "SNIP"

// 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 **************************************/

// 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);

Locked
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.

Return to “Internet of Things: Adafruit IO and Wippersnapper”