0

io.whatever was not declared in this scope
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

io.whatever was not declared in this scope

by robcauson on Sat Mar 30, 2019 6:10 pm

Evening. I hate to start this way since I'm sure so many do, but I'm quite new to this and I've hit a brick wall, so I'd appreciate any help that might be offered. I've got an esp8266 board (Chinese Node MCU type) with a short string of ws2812s attached to it, which I'm trying to set up to be controllable via a google home mini following a tutorial I found somewhere-or-other. I've set up an adafruit.io feed and I've got an IFTTT applet running, and so that side of things is working (I can see it online when I say my trigger phrase), but I can't get the hardware side sorted because the IDE keeps chucking errors at me when I try to compile the sketch. I've corrected whatever I think needs correcting in the sketch from the tutorial but I'm not getting anywhere.

My code is as follows:

Code: Select all | TOGGLE FULL SIZE

#include "config.h"
#include "FastLED.h"
#include "AdafruitIO_WiFi.h"

#define NUM_LEDS    29
#define CHIPSET     WS2812
#define COLOR_ORDER GRB
#define DATA_PIN 5
#define FEED_OWNER "jobdawson"
CRGB leds[NUM_LEDS];

AdafruitIO_Feed *sharedFeed = io.feed("TV Unit", FEED_OWNER);

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

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

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

  // connect to io.adafruit.com
  io.connect();

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

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

  // we are connected
  Serial.println();
  Serial.println(io.statusText());
  sharedFeed->get();
  FastLED.addLeds<WS2812, DATA_PIN, GRB>(leds, NUM_LEDS);
}

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 a 'counter' message
// is received from Adafruit IO. it was attached to
// the counter feed in the setup() function above.
void handleMessage(AdafruitIO_Data *data)
{
  String s = data->value();
  Serial.print("received <- ");
  Serial.println(s);
 
  CRGB colour = CRGB::Black;
 
  if (s == "off")
  {
    colour = CRGB::Black;
  }
  if (s == "full")
  {
    colour = CRGB::White;
  }
  if (s == "chill")
  {
    colour = CRGB::Purple;
  }
  if (s == "warm")
  {
    colour = CRGB::DarkOrange;
  }
  if (s == "dim")
  {
    colour = CRGB::DarkSeaGreen;
  }

  fill_solid( leds, NUM_LEDS, colour);

}


Most of this is the stuff from the tutorial, so I recognise the fact that he's used examples but removed all the copyright intro stuff. I've added some of the defines because it seemed like there were some missing.

The error I'm getting, no matter what I do, is as follows:

Arduino: 1.8.9 (Linux), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled, 4M (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

In file included from /home/rob/Downloads/GoogleHomeLED-master/googlehome/googlehome.ino:3:0:
/home/rob/Arduino/libraries/FastLED/FastLED.h:14:21: note: #pragma message: FastLED version 3.002.006
# pragma message "FastLED version 3.002.006"
^
In file included from /home/rob/Arduino/libraries/FastLED/FastLED.h:65:0,
from /home/rob/Downloads/GoogleHomeLED-master/googlehome/googlehome.ino:3:
/home/rob/Arduino/libraries/FastLED/fastspi.h:110:23: note: #pragma message: No hardware SPI pins defined. All SPI access will default to bitbanged output
# pragma message "No hardware SPI pins defined. All SPI access will default to bitbanged output"
^
googlehome:13:31: error: 'io' was not declared in this scope
AdafruitIO_Feed *sharedFeed = io.feed("TV Unit", FEED_OWNER);
^
/home/rob/Downloads/GoogleHomeLED-master/googlehome/googlehome.ino: In function 'void setup()':
googlehome:27:3: error: 'io' was not declared in this scope
io.connect();
^
googlehome:36:10: error: 'IO' was not declared in this scope
while (IO.status() < AIO_CONNECTED)
^
/home/rob/Downloads/GoogleHomeLED-master/googlehome/googlehome.ino: In function 'void loop()':
googlehome:55:3: error: 'IO' was not declared in this scope
IO.run();
^
exit status 1
'io' was not declared in this scope

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

It doesn't like io in any context. I've googled and tried everything I've found there - making sure the IDE isn't nested inside a second folder (I'm using Ubuntu), making sure the defines in my config.h are also defined in the main sketch, installing every even remotely related library and restarting the IDE and so on, but I can't get it to work.

This doesn't feel like it should be a particularly difficult thing, with what limited experience I have, but I'm stuck. Any suggestions would be appreciated.

Thanks

robcauson
 
Posts: 1
Joined: Sat Mar 30, 2019 5:52 pm

Re: io.whatever was not declared in this scope

by brubell on Mon Apr 01, 2019 1:05 pm

Please follow the setup guide linked below to ensure you have all the Arduino library dependencies for the Adafruit IO library installed.
https://learn.adafruit.com/adafruit-io- ... io-library

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

Please be positive and constructive with your questions and comments.