Something that compiled before now isn't - I've changed nothing, and already tried reinstalling everything - help?

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
basilbowman
 
Posts: 6
Joined: Wed Dec 21, 2022 7:43 pm

Something that compiled before now isn't - I've changed nothing, and already tried reinstalling everything - help?

Post by basilbowman »

Hey y'all - so I'm making a set of long distance lamps for my mom for Christmas, following this instructable:

https://www.instructables.com/CoronaLam ... e-Can-Mak/

I was able to get it to compile and run and show the spin() indicating connection, and also was able to connect to the Adafruit IO server initially, but now when I try to compile and upload the code, I get the following errors. Have the whole day to troubleshoot - any suggestions on where to start?

Code: Select all

C:\Users\Lenovo\Projects\Arduino\Lamp Try 2\CoronaLamp\CoronaLamp.ino:11:1: error: 'AdafruitIO_Feed' does not name a type
   11 | AdafruitIO_Feed *lamp = io.feed("lamp");
      | ^~~~~~~~~~~~~~~
C:\Users\Lenovo\Projects\Arduino\Lamp Try 2\CoronaLamp\CoronaLamp.ino:137:6: error: variable or field 'handleMessage' declared void
  137 | void handleMessage(AdafruitIO_Data *data) {
      |      ^~~~~~~~~~~~~
C:\Users\Lenovo\Projects\Arduino\Lamp Try 2\CoronaLamp\CoronaLamp.ino:137:20: error: 'AdafruitIO_Data' was not declared in this scope
  137 | void handleMessage(AdafruitIO_Data *data) {
      |                    ^~~~~~~~~~~~~~~
C:\Users\Lenovo\Projects\Arduino\Lamp Try 2\CoronaLamp\CoronaLamp.ino:137:37: error: 'data' was not declared in this scope; did you mean 'std::data'?
  137 | void handleMessage(AdafruitIO_Data *data) {
      |                                     ^~~~
      |                                     std::data
In file included from c:\users\lenovo\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\array:41,
                 from c:\users\lenovo\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\tuple:39,
                 from c:\users\lenovo\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\functional:54,
                 from c:\users\lenovo\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\pstl\glue_algorithm_defs.h:13,
                 from c:\users\lenovo\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\algorithm:74,
                 from C:\Users\Lenovo\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:225,
                 from C:\Users\Lenovo\AppData\Local\Temp\arduino-sketch-E810C5B6B8FB2C902B3F66CD860AACA2\sketch\CoronaLamp.ino.cpp:1:
c:\users\lenovo\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\range_access.h:319:5: note: 'std::data' declared here
  319 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
C:\Users\Lenovo\Projects\Arduino\Lamp Try 2\CoronaLamp\CoronaLamp.ino: In function 'void setup()':
C:\Users\Lenovo\Projects\Arduino\Lamp Try 2\CoronaLamp\CoronaLamp.ino:48:3: error: 'io' was not declared in this scope
   48 |   io.connect();
      |   ^~
C:\Users\Lenovo\Projects\Arduino\Lamp Try 2\CoronaLamp\CoronaLamp.ino:51:3: error: 'lamp' was not declared in this scope
   51 |   lamp->onMessage(handleMessage);
      |   ^~~~
C:\Users\Lenovo\Projects\Arduino\Lamp Try 2\CoronaLamp\CoronaLamp.ino:51:19: error: 'handleMessage' was not declared in this scope
   51 |   lamp->onMessage(handleMessage);
      |                   ^~~~~~~~~~~~~
C:\Users\Lenovo\Projects\Arduino\Lamp Try 2\CoronaLamp\CoronaLamp.ino:54:23: error: 'AIO_CONNECTED' was not declared in this scope
   54 |   while(io.status() < AIO_CONNECTED) {
      |                       ^~~~~~~~~~~~~
C:\Users\Lenovo\Projects\Arduino\Lamp Try 2\CoronaLamp\CoronaLamp.ino: In function 'void loop()':
C:\Users\Lenovo\Projects\Arduino\Lamp Try 2\CoronaLamp\CoronaLamp.ino:75:3: error: 'io' was not declared in this scope
   75 |   io.run();
      |   ^~
C:\Users\Lenovo\Projects\Arduino\Lamp Try 2\CoronaLamp\CoronaLamp.ino: In function 'void touch()':
C:\Users\Lenovo\Projects\Arduino\Lamp Try 2\CoronaLamp\CoronaLamp.ino:106:5: error: 'lamp' was not declared in this scope
  106 |     lamp->save(lampVal);
      |     ^~~~
C:\Users\Lenovo\Projects\Arduino\Lamp Try 2\CoronaLamp\CoronaLamp.ino:119:7: error: 'lamp' was not declared in this scope
  119 |       lamp->save(0);
      |       ^~~~
C:\Users\Lenovo\Projects\Arduino\Lamp Try 2\CoronaLamp\CoronaLamp.ino: At global scope:
C:\Users\Lenovo\Projects\Arduino\Lamp Try 2\CoronaLamp\CoronaLamp.ino:137:6: error: variable or field 'handleMessage' declared void
  137 | void handleMessage(AdafruitIO_Data *data) {
      |      ^~~~~~~~~~~~~
C:\Users\Lenovo\Projects\Arduino\Lamp Try 2\CoronaLamp\CoronaLamp.ino:137:20: error: 'AdafruitIO_Data' was not declared in this scope
  137 | void handleMessage(AdafruitIO_Data *data) {
      |                    ^~~~~~~~~~~~~~~
C:\Users\Lenovo\Projects\Arduino\Lamp Try 2\CoronaLamp\CoronaLamp.ino:137:37: error: 'data' was not declared in this scope; did you mean 'std::data'?
  137 | void handleMessage(AdafruitIO_Data *data) {
      |                                     ^~~~
      |                                     std::data
In file included from c:\users\lenovo\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\array:41,
                 from c:\users\lenovo\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\tuple:39,
                 from c:\users\lenovo\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\functional:54,
                 from c:\users\lenovo\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\pstl\glue_algorithm_defs.h:13,
                 from c:\users\lenovo\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\algorithm:74,
                 from C:\Users\Lenovo\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:225,
                 from C:\Users\Lenovo\AppData\Local\Temp\arduino-sketch-E810C5B6B8FB2C902B3F66CD860AACA2\sketch\CoronaLamp.ino.cpp:1:
c:\users\lenovo\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\range_access.h:319:5: note: 'std::data' declared here
  319 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~

exit status 1

Compilation error: 'AdafruitIO_Feed' does not name a type

User avatar
basilbowman
 
Posts: 6
Joined: Wed Dec 21, 2022 7:43 pm

Re: Something that compiled before now isn't - I've changed nothing, and already tried reinstalling everything - help?

Post by basilbowman »

Genuinely changed nothing at all - my day job is in tech, I'm new to arduino but not coding or support - I know how this sounds, but I swear to you, the only thing I did was upload the Coronalamp.io code, then upload the neopixel test code (which works great), and then go back and try to re-uploard the Coronalamp.io code.

All of a sudden, it won't compile, whereas before it would.

Working with a Wemos D1mini clone - and I've tried compiling it for a few different 8266 boards.

Things I've already tried:
1.) uninstalling and reinstalling everything
2.) redownloading the code and setting up a new sketch
3.) drinking a bottle of whiskey
4.) installing the V2 code (located here: https://github.com/DevJav/best_friend_lamp_arduino)
4 a: This worked to connect to the adafruit IO server (sometimes) - but the NeoPixelBus library didn't seem to want to behave

Any thoughts?

User avatar
basilbowman
 
Posts: 6
Joined: Wed Dec 21, 2022 7:43 pm

Re: Something that compiled before now isn't - I've changed nothing, and already tried reinstalling everything - help?

Post by basilbowman »

Ok, I'm just going to live-blog my troubleshooting efforts here:

1.) It specifically appears to be around the AdafruitIO library - so I've uninstalled every library, deleted the users/arduino/libraries folder and the appData/local/etc library folder as well. Currently re-installing everything, will update afterwards. (Update: nope)

2.) Re-installing appears to require a bunch of dependencies, which I have previously installed, and which are showing as installed, but even those aren't installing correctly. No idea why.

3.) Still throwing the same errors around the Adafruit IO library, which were perfectly fine yesterday (I was correctly updating the feed around 6pm EST).

User avatar
basilbowman
 
Posts: 6
Joined: Wed Dec 21, 2022 7:43 pm

Re: Something that compiled before now isn't - I've changed nothing, and already tried reinstalling everything - help?

Post by basilbowman »

Ok - it's got to be around the arduino IDE library manager. I set up a new user on my machine, installed the IDE and the libraries, and it's working again.

I've tried loading the libraries manually and/or automatically, and nothing doing. I'm going to to chock this up to me not knowing wtf to do and the IDE handling that badly - hopefully this is at least helpful for the poor bastard that finds this ancient forum post in 15 years - no clue what actually happened, but go try a new instance and a new account and see what happens?

User avatar
Franklin97355
 
Posts: 23911
Joined: Mon Apr 21, 2008 2:33 pm

Re: Something that compiled before now isn't - I've changed nothing, and already tried reinstalling everything - help?

Post by Franklin97355 »

One thing you can do if Arduino seems conflicted is to delete the Arduino15 folder when the ide is off and then restart the ide. that rebuilds the folder and besides having to set up your preferences again it sometimes fixes the problem.

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

Re: Something that compiled before now isn't - I've changed nothing, and already tried reinstalling everything - help?

Post by brubell »

Hi, this is suspect to me..

Code: Select all

error: 'io' was not declared in this scope
   48 |   io.connect();
1) Which board are you using with this sketch?
2) Could you paste the sketch you're using in this thread?
3) Is there a config.h file that's getting compiled with the sketch? Could you paste it here?

User avatar
basilbowman
 
Posts: 6
Joined: Wed Dec 21, 2022 7:43 pm

Re: Something that compiled before now isn't - I've changed nothing, and already tried reinstalling everything - help?

Post by basilbowman »

1.) Wemos D1 Clone (mini 8266) tested on a few boards I had lying around so I know it's not a hardware issue

2.) Sketch I'm using is the one linked, but I'll copy/paste it at the bottom of this reply.

3.) Config is also compiled, yeah, but it's only changing the IO feed info and my wifi info.

I should also say, that creating a new user account on my machine and re-installing everything worked just fine. Now it will install, using the exact same sketch and config.h file - the same libraries, the same versions. I had previously deleted and uninstalled everything (even the local/temporary stuff) and it still threw up errors, but now it's doing just fine.

I did run into a separate issue though, and I'll put that in the Adafruit IO thread...


Sketch---

Code: Select all

#include <AdafruitIO.h>
#include <AdafruitIO_Dashboard.h>
#include <AdafruitIO_Data.h>
#include <AdafruitIO_Definitions.h>
#include <AdafruitIO_Ethernet.h>
#include <AdafruitIO_FONA.h>
#include <AdafruitIO_Feed.h>
#include <AdafruitIO_Group.h>
#include <AdafruitIO_MQTT.h>
#include <AdafruitIO_Time.h>
#include <AdafruitIO_WiFi.h>

//import the libraries
#include <Adafruit_NeoPixel.h>
#include "config.h"

//define the Neopixel pin, this will be different then the pin we soldered the Neopixels to, as they are marked differently
#define PIN 5


//initialize the information for the Neopixels and Adafruit IO
Adafruit_NeoPixel strip = Adafruit_NeoPixel(16, PIN, NEO_GRB + NEO_KHZ800);
AdafruitIO_Feed *lamp = io.feed("lamp");

//how long we want the lamps to stay on when activated (600,000 ms = 10 minutes)
const long interval = 600000;

//setup the timers and status for the lamp
unsigned long previousMillis = 0;
int tap = 0;

//set one of the lamps to 1, the other to 2
int lampVal = 2;

//the value that should activate the lamp. Don't mess with this, the code will figure out what this should be in the setup
int recVal = 0;



void setup() {

  //Start the serial monitor for debugging and status
  Serial.begin(9600);

  //figure out what recieved value should turn on the lamp (lampVal of other lamp)
  if (lampVal == 1) recVal = 2;
  if (lampVal == 2) recVal = 1;
  
  //Activate the Neopixels
  strip.begin();
  strip.setBrightness(255);
  strip.show(); // Initialize all pixels to 'off'

  //setup the touch sensor as a interrupt and input
  pinMode(12, INPUT);
  attachInterrupt(digitalPinToInterrupt(12), touch, CHANGE);
  
  //start connecting to Adafruit IO
  Serial.print("Connecting to Adafruit IO");
  io.connect();

  //get the status of the value in Adafruit IO
  lamp->onMessage(handleMessage);

  //connect to Adafruit IO and play the "spin" Neopixel animation to show it's connecting until and connection is established
  while(io.status() < AIO_CONNECTED) {
    Serial.print(".");
    spin();
    delay(500);
  }

  //when a connection to Adafruit IO is made write the status in the Serial monitor and flash the Neopixels white
  Serial.println();
  Serial.println(io.statusText());
  flash();

  //get the status of our value in Adafruit IO
  lamp->get();
  
  
  previousMillis = millis();
}

void loop() {

  //keeps the ESP8266 connected to Adafruit IO
  io.run();

  //set the starting timer value
  unsigned long currentMillis = millis();

  //tap = 1 means that we have established that the other lamp was tapped
  if (tap == 1) {

    //check to see if the timer if over 10 minutes. If it is, turn off the Neopixels and reset the tap status
    if (currentMillis - previousMillis >= interval) {
      off();
      tap = 0;
    
    } else {

      //if the timer isn't over 10 minutes, continue playing the rainbow animation at a slow speed
      rainbow(200);
      
    }
    
  }
  
}


//the interrupt program that runs when the touch sensor is activated
ICACHE_RAM_ATTR void touch() {

  //while the touch sensor is activated, save the lampVal (either 1 or 2) to the Adafruit IO feed and turn the Neopixels to purple
  while (digitalRead(12) == 1) {

    lamp->save(lampVal);
    
      for(int i=0; i<strip.numPixels(); i++) {
        
      strip.setPixelColor(i, 102, 0, 204);
      
    }
    
    strip.show();

   //once the touch sensor isn't activated, send a 0 back to the Adafruit IO feed. 
  } if (digitalRead(12) == 0) {
    
      lamp->save(0);
      
      for(int i=0; i<strip.numPixels(); i++) {
        
      strip.setPixelColor(i, 0, 0, 0);
      
    }
    
    strip.show();
    
  }
  

  
}


//code that tells the ESP8266 what to do when it recieves new data from the Adafruit IO feed
void handleMessage(AdafruitIO_Data *data) {

  Serial.print("received <- ");

  //convert the recieved data to an INT
  int reading = data->toInt();

  //if the recieved value is equal to the recVal, and the lamp status is currently off, change the status to on and recent the timer
  if(reading == recVal && tap == 0) {
    
    Serial.println("TAP");
    previousMillis = millis();
    tap = 1;

  //if we recieve a value but the lamp is already on nothing happens
  } else {
    Serial.println("LOW");
  }

}

//simple code to turn all of the Neopixels off
void off() {
  
for(int i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, 0, 0, 0);
    }
    strip.show();
  
}


//The code that creates the gradual color change animation in the Neopixels (thank you to Adafruit for this!!)
void rainbow(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256; j++) {
    for(i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel((i+j) & 255));
    }
    strip.show();
    delay(wait);
  }
}


//complicated geometry or something to figure out the color values (I don't know how this stuff works, thank goodness for adafruit)
uint32_t Wheel(byte WheelPos) {
  WheelPos = 255 - WheelPos;
  if(WheelPos < 85) {
    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  }
  if(WheelPos < 170) {
    WheelPos -= 85;
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
  WheelPos -= 170;
  return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}


//code to flash the Neopixels when a stable connection to Adafruit IO is made
void flash() {

  for(int i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, 255, 255, 255);
    }
  strip.show();
  
  delay(200);

  for(int i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, 0, 0, 0);
    }
  strip.show();
  
  delay(200);

  for(int i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, 255, 255, 255);
    }
  strip.show();
  
  delay(200);

  for(int i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, 0, 0, 0);
    }
  strip.show();
  
  delay(200);
}


//the code to create the blue spinning animation when connecting to Adafruit IO
void spin() {

  for(int i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, 0, 0, 255);
      strip.show();
      delay(20);
    }
    for(int i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, 0, 0, 0);
      strip.show();
      delay(20);
    }
  
}

config I can share if you want, but that was not the issue.

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”