AdafruitIO_Wifi does not name a type Error

Hello all,
This is my second library question in a very short time span, but I was using Adafruit IO, and I needed to use the libraries. However, no matter how hard I try, there is always a does not name a type error for AdafruitIO_Wifi. And indeed, I cannot find where it is! It was not in AdafruitIO.h, where it presumably should be, and there is no cpp file to match AdafruitIO_Wifi.h. Where did it go?? As a result of this, I have 4 more errors. Please help! I will put my code below:

#include <Arduino.h>
#include <Arduino_MKRENV.h>
#include "AdafruitIO_WiFi.h"
#include "AdafruitIO.h"
#include <Adafruit_Sensor.h>

#define IO_USERNAME " "
#define IO_KEY " "

#define WIFI_SSID " "
#define WIFI_PASS " "

#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

const char SSID[] = "NETGEAR10";
const char PASS[] = "basicearth863";

int airPressure;
int humidity;
int light;
int uVIndex;
int temperature;

AdafruitIO_Feed *temperaturefeed = io.feed("temperaturefeed");
AdafruitIO_Feed *humidityfeed = io.feed("humidityfeed");

void setup()
{
  Serial.begin(9600);
  delay(1500);

  if (!ENV.begin())
  {
    Serial.println("Failed to initialize MKR ENV shield!");
    while (1)
      ;

    pinMode(LED_BUILTIN, OUTPUT);
  }

  Serial.print("Connecting to Adafruit IO");
  io.connect();

  while (io.status() < AIO_CONNECTED)
  {
    Serial.print(".");
    delay(500);
  }

  // we are connected
  Serial.println();
  Serial.println(io.statusText());
}

void loop()
{
  io.run();

  temperature = ENV.readTemperature(FAHRENHEIT);
  temperaturefeed->save(temperature);

  humidity = ENV.readHumidity();
  humidityfeed->save(humidity);

  airPressure = ENV.readPressure(PSI);
  light = ENV.readIlluminance(LUX);
  uVIndex = ENV.readUVIndex();
  Serial.print("Temperature: ");
  Serial.println(temperature);
  Serial.print("Humidity: ");
  Serial.println(humidity);
  Serial.print("Air pressure: ");
  Serial.println(airPressure);
  Serial.print("Light: ");
  Serial.println(light);
  Serial.print("UV: ");
  Serial.println(uVIndex);
  Serial.println(' ');

  digitalWrite(LED_BUILTIN, LOW);
  delay(250);
  digitalWrite(LED_BUILTIN, HIGH);
  delay(250);
}

Thanks in advance for any help!
Also, I left the 4 fields for the username, password, and WiFi creds blank in the code I posted for privacy, but in the real code, it is filled in.

1 Like

So what’s the platformio.ini? That’s the ciritical part.

Sorry, here it is:

[env:mkrwifi1010]
platform = atmelsam
board = mkrwifi1010
framework = arduino
lib_deps = arduino-libraries/Arduino_MKRENV@^1.1.0, adafruit/Adafruit IO Arduino@^4.0.2, adafruit/Adafruit MQTT Library@^2.1.0
lib_ignore = SSU, SFU
monitor_speed = 9600

The mkrwifi1010 (Arduino MKR WiFi 1010) does not appear to be supported by the Adafruit IO Arduino Library. The mkr1000USB (Arduino MKR1000) is… did you by any chance put in the wrong board id?

Nowhere… it doesn’t exist. Only the header file is used, to switch the rest of the code between the various supported wifi / ethernet board modes.

I looked at this link. It uses BOTH the Wifi 1010 and Adafruit IO. I’m sooo confused! I also saw that it was not a supported board. But the article uses it…?

OK, so yes, that example does indeed uses the 101, and talks to AdafruitIO. But it does not use the AdafruitIO library to do so.

The code used is here : iot_arduino_adafruit/readsensors_sendtoadafruit_iotcloud at master · avilmaru/iot_arduino_adafruit · GitHub

You’ll want to read the AdafruitIO specific section of the article to understand how it works… (ie. Ignore the first ArduinoIoT section)

https://create.arduino.cc/projecthub/Avilmaru/iot-interacting-with-arduino-adafruit-iot-cloud-19e26f

Thanks! Boy, am I dumb…I should read the documentation :man_facepalming:. Thanks for the help! Sorry for the noob question