Arduino IO error: "'AdafruitIO_Feed' does not name a type"

I’m trying to learn how to push data to IO using my SparkFun ESP8266 Wifi Shield. To do so, I made sure to install the following libraries:

  • ArduinoHttpClient
  • Adafruit ESP8266
  • Adafruit IO Arduino
  • Adafruit MQTT Library

Then using the adafruitio_09_analog_out example file, I set up my IO account name and key, and modified the wifi settings to use the SparkFun wifi code. When I try to compile the code, I get the following errors:

Arduino: 1.8.1 (Windows 10), Board: "Arduino/Genuino Uno"

In file included from C:\Users\Peter\Documents\Arduino\libraries\SparkFun-Temp\src/SparkFunESP8266WiFi.h:28:0,

                 from C:\Users\Peter\Documents\Arduino\libraries\SparkFun-Temp\src/SparkFunESP8266Client.h:28,

                 from sketch\config.h:17,

                 from C:\Users\Peter\AppData\Local\Temp\arduino_modified_sketch_736726\adafruitio_09_analog_out.ino:19:

C:\Users\Peter\Documents\Arduino\libraries\SparkFun-Temp\src/SparkFunESP8266Server.h:35:2: error: 'ESP8266Client' does not name a type

  ESP8266Client available(uint8_t wait = 0);

  ^

adafruitio_09_analog_out:27: error: 'AdafruitIO_Feed' does not name a type

 AdafruitIO_Feed *analog = io.feed("analog");

 ^

adafruitio_09_analog_out:72: error: variable or field 'handleMessage' declared void

 void handleMessage(AdafruitIO_Data *data) {

                    ^

adafruitio_09_analog_out:72: error: 'AdafruitIO_Data' was not declared in this scope

adafruitio_09_analog_out:72: error: 'data' was not declared in this scope

 void handleMessage(AdafruitIO_Data *data) {

                                     ^

C:\Users\Peter\AppData\Local\Temp\arduino_modified_sketch_736726\adafruitio_09_analog_out.ino: In function 'void setup()':

adafruitio_09_analog_out:39: error: 'io' was not declared in this scope

   io.connect();

   ^

adafruitio_09_analog_out:45: error: 'analog' was not declared in this scope

   analog->onMessage(handleMessage);

   ^

adafruitio_09_analog_out:45: error: 'handleMessage' was not declared in this scope

   analog->onMessage(handleMessage);

                     ^

adafruitio_09_analog_out:48: error: 'AIO_CONNECTED' was not declared in this scope

   while(io.status() < AIO_CONNECTED) {

                       ^

C:\Users\Peter\AppData\Local\Temp\arduino_modified_sketch_736726\adafruitio_09_analog_out.ino: In function 'void loop()':

adafruitio_09_analog_out:65: error: 'io' was not declared in this scope

   io.run();

   ^

C:\Users\scardu\AppData\Local\Temp\arduino_modified_sketch_736726\adafruitio_09_analog_out.ino: At global scope:

adafruitio_09_analog_out:72: error: variable or field 'handleMessage' declared void

 void handleMessage(AdafruitIO_Data *data) {

                    ^

adafruitio_09_analog_out:72: error: 'AdafruitIO_Data' was not declared in this scope

adafruitio_09_analog_out:72: error: 'data' was not declared in this scope

 void handleMessage(AdafruitIO_Data *data) {

                                     ^

exit status 1
'AdafruitIO_Feed' does not name a type

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Some Googling suggests that “does not name a type” usually means I’m missing a library. Any ideas? The example code is:

// Adafruit IO Analog Out Example
// Tutorial Link: https://learn.adafruit.com/adafruit-io-basics-analog-output
//
// Adafruit invests time and resources providing this open source code.
// Please support Adafruit and open source hardware by purchasing
// products from Adafruit!
//
// Written by Todd Treece for Adafruit Industries
// Copyright (c) 2016 Adafruit Industries
// Licensed under the MIT license.
//
// All text above must be included in any redistribution.

/************************** Configuration ***********************************/

// edit the config.h tab and enter your Adafruit IO credentials
// and any additional configuration needed for WiFi, cellular,
// or ethernet clients.
#include "config.h"

/************************ Example Starts Here *******************************/

// this should correspond to a pin with PWM capability
#define LED_PIN 5

// set up the 'analog' feed
AdafruitIO_Feed *analog = io.feed("analog");

void setup() {

  // start the serial connection
  Serial.begin(115200);

  // wait for serial monitor to open
  while(! Serial);

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

  // set up a message handler for the 'analog' feed.
  // the handleMessage function (defined below)
  // will be called whenever a message is
  // received from adafruit io.
  analog->onMessage(handleMessage);

  // wait for a connection
  while(io.status() < AIO_CONNECTED) {
    Serial.print(".");
    delay(500);
  }

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

}

void loop() {

  // io.run(); is required for all sketches.
  // it should always be present at the top of your loop
  // function. it keeps the client connected to
  // io.adafruit.com, and processes any incoming data.
  io.run();

}

// this function is called whenever an 'analog' message
// is received from Adafruit IO. it was attached to
// the analog feed in the setup() function above.
void handleMessage(AdafruitIO_Data *data) {

  // convert the data to integer
  int reading = data->toInt();

  Serial.print("received <- ");
  Serial.println(reading);
  analogWrite(LED_PIN, reading);

}

And the modified config.h code:

/************************ 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    "scada"
#define IO_KEY         "MYKEY"

/******************************* 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 M0 WiFi -> https://www.adafruit.com/products/3010
//   - Feather WICED -> https://www.adafruit.com/products/3056

#include <SoftwareSerial.h>
#include <SparkFunESP8266Client.h>
#include <SparkFunESP8266Server.h>
#include <SparkFunESP8266WiFi.h>

const char mySSID[] = "MYSSID";
const char myPSK[] = "MYPW";
ESP8266Server server = ESP8266Server(80);

// comment out the following two lines if you are using fona or ethernet
//#include "AdafruitIO_WiFi.h"
//AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS);

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

To do so, I made sure to install the following libraries:

That you got from WalMart?

Any ideas?

Tel us where you got the libraries.

I installed the libraries using this link: Arduino IO Library | Adafruit IO Basics: ESP8266 + Arduino | Adafruit Learning System

Basically, straight from the manage libraries toolbox in the IDE.

I installed the libraries using this link

I find it difficult to believe that Adafruit's process installs Sparkfun libraries.

Ah, good point. I installed the 4 libraries I mentioned in OP using the Adafruit software. I hooked up Sparkfun's wifi shield using their guide, installed the library using their github link and then updated it through the Arduino software.

Edit: the error is referencing a code that is specific to the IO though. I will reinstall the software and my libraries and see if that will solve anything, but if you could clarify the connection between the error and sparkfun I'd love to add it to my knowledge repository.

Edit: the error is referencing a code that is specific to the IO though.

The LAST error does. You start fixing errors with the FIRST error, though.

Ah, I see.

I uninstalled IDE, deleted the libraries, then reinstalled IDE. Finally I put the Sparkfun library back in the library through github and reinstalled the four libraries in the OP through the IDE. I still get the same errors.

Arduino: 1.8.2 (Windows 10), Board: "Arduino/Genuino Uno"

adafruitio_09_analog_out:27: error: 'AdafruitIO_Feed' does not name a type

 AdafruitIO_Feed *analog = io.feed("analog");

 ^

adafruitio_09_analog_out:72: error: variable or field 'handleMessage' declared void

 void handleMessage(AdafruitIO_Data *data) {

                    ^

adafruitio_09_analog_out:72: error: 'AdafruitIO_Data' was not declared in this scope

adafruitio_09_analog_out:72: error: 'data' was not declared in this scope

 void handleMessage(AdafruitIO_Data *data) {

                                     ^

C:\Users\Peter\AppData\Local\Temp\arduino_modified_sketch_881700\adafruitio_09_analog_out.ino: In function 'void setup()':

adafruitio_09_analog_out:39: error: 'io' was not declared in this scope

   io.connect();

   ^

adafruitio_09_analog_out:45: error: 'analog' was not declared in this scope

   analog->onMessage(handleMessage);

   ^

adafruitio_09_analog_out:45: error: 'handleMessage' was not declared in this scope

   analog->onMessage(handleMessage);

                     ^

adafruitio_09_analog_out:48: error: 'AIO_CONNECTED' was not declared in this scope

   while(io.status() < AIO_CONNECTED) {

                       ^

C:\Users\Peter\AppData\Local\Temp\arduino_modified_sketch_881700\adafruitio_09_analog_out.ino: In function 'void loop()':

adafruitio_09_analog_out:65: error: 'io' was not declared in this scope

   io.run();

   ^

C:\Users\Peter\AppData\Local\Temp\arduino_modified_sketch_881700\adafruitio_09_analog_out.ino: At global scope:

adafruitio_09_analog_out:72: error: variable or field 'handleMessage' declared void

 void handleMessage(AdafruitIO_Data *data) {

                    ^

adafruitio_09_analog_out:72: error: 'AdafruitIO_Data' was not declared in this scope

adafruitio_09_analog_out:72: error: 'data' was not declared in this scope

 void handleMessage(AdafruitIO_Data *data) {

                                     ^

exit status 1
'AdafruitIO_Feed' does not name a type

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I must be missing some library but I can’t figure out what exactly. I went ahead and installed any adafruit IO libraries I saw from within the IDE, but still nothing:

Arduino: 1.8.2 (Windows 10), Board: "Arduino/Genuino Uno"

adafruitio_09_analog_out:27: error: 'AdafruitIO_Feed' does not name a type

 AdafruitIO_Feed *analog = io.feed("analog");

 ^

adafruitio_09_analog_out:72: error: variable or field 'handleMessage' declared void

 void handleMessage(AdafruitIO_Data *data) {

                    ^

adafruitio_09_analog_out:72: error: 'AdafruitIO_Data' was not declared in this scope

adafruitio_09_analog_out:72: error: 'data' was not declared in this scope

 void handleMessage(AdafruitIO_Data *data) {

                                     ^

C:\Users\Peter\AppData\Local\Temp\arduino_modified_sketch_571705\adafruitio_09_analog_out.ino: In function 'void setup()':

adafruitio_09_analog_out:39: error: 'io' was not declared in this scope

   io.connect();

   ^

adafruitio_09_analog_out:45: error: 'analog' was not declared in this scope

   analog->onMessage(handleMessage);

   ^

adafruitio_09_analog_out:45: error: 'handleMessage' was not declared in this scope

   analog->onMessage(handleMessage);

                     ^

adafruitio_09_analog_out:48: error: 'AIO_CONNECTED' was not declared in this scope

   while(io.status() < AIO_CONNECTED) {

                       ^

C:\Users\Peter\AppData\Local\Temp\arduino_modified_sketch_571705\adafruitio_09_analog_out.ino: In function 'void loop()':

adafruitio_09_analog_out:65: error: 'io' was not declared in this scope

   io.run();

   ^

C:\Users\Peter\AppData\Local\Temp\arduino_modified_sketch_571705\adafruitio_09_analog_out.ino: At global scope:

adafruitio_09_analog_out:72: error: variable or field 'handleMessage' declared void

 void handleMessage(AdafruitIO_Data *data) {

                    ^

adafruitio_09_analog_out:72: error: 'AdafruitIO_Data' was not declared in this scope

adafruitio_09_analog_out:72: error: 'data' was not declared in this scope

 void handleMessage(AdafruitIO_Data *data) {

                                     ^

exit status 1
'AdafruitIO_Feed' does not name a type

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

As an update, I’m on a new PC at the moment and I installed Arduino then went through this guide to install the mentioned libraries from within IDE. But nothing. Am I missing something super basic that every newbie was able to follow that Adafruit IO Basics guide successfully? Googling the error returns my own thread.

This time I tried the adafruit publish example and received this error:

Arduino: 1.8.1 (Windows 10), Board: "Arduino/Genuino Uno"

adafruitio_00_publish:26: error: 'AdafruitIO_Feed' does not name a type

 AdafruitIO_Feed *counter = io.feed("counter");

 ^

C:\Users\Peter\AppData\Local\Temp\arduino_modified_sketch_645138\adafruitio_00_publish.ino: In function 'void setup()':

adafruitio_00_publish:39: error: 'io' was not declared in this scope

   io.connect();

   ^

adafruitio_00_publish:42: error: 'AIO_CONNECTED' was not declared in this scope

   while(io.status() < AIO_CONNECTED) {

                       ^

C:\Users\Peter\AppData\Local\Temp\arduino_modified_sketch_645138\adafruitio_00_publish.ino: In function 'void loop()':

adafruitio_00_publish:59: error: 'io' was not declared in this scope

   io.run();

   ^

adafruitio_00_publish:64: error: 'counter' was not declared in this scope

   counter->save(count);

   ^

exit status 1
'AdafruitIO_Feed' does not name a type

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

It is interesting that the link in your last post takes you to the middle of a page, where the heading is:

Setup ESP8266 Support

and yet

Arduino: 1.8.1 (Windows 10), Board: "Arduino/Genuino Uno"

The libraries you are trying to use are not meant for the Uno.

PaulS:
It is interesting that the link in your last post takes you to the middle of a page, where the heading is:and yetThe libraries you are trying to use are not meant for the Uno.

Oh damn.

I just assumed that since Sparkfun Shield is ESP8266, and it's attached to my Uno, I can use libraries for it. Does this mean I just need to switch the board to Shield and upload the code directly to it? Or that I'm completely out of luck and need to figure another way other than Adafruit IO to record my data?

Edit: Well, it compiles perfectly if I just switch the board to Sparkfun ESP8266 Thing. Although I doubt I can use it, since there is no option to switch the board to Sparkfun ESP8266 Shield. I suppose this is a deadend?