No such file or directory ... compile error

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
_phillip
 
Posts: 313
Joined: Fri Apr 09, 2021 3:28 pm

No such file or directory ... compile error

Post by _phillip »

I have no reference to > SoftwareSerial.h in my sketch. So why am I getting this compile error message?

Here is the sketch I am trying to learn from:

Code: Select all

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

#include <DHT.h>
#include <DHT_U.h>

 
// pin connected to DH22 data line
#define DATA_PIN 2

// create DHT22 instance
DHT_Unified dht(DATA_PIN, DHT22);

// set up the 'temperature' and 'humidity' feeds
AdafruitIO_Feed *temperature = io.feed("temperature");
AdafruitIO_Feed *humidity = io.feed("humidity");

void setup() {

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

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

  // initialize dht22
  dht.begin();

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

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

  sensors_event_t event;
  dht.temperature().getEvent(&event);

  float celsius = event.temperature;
  float fahrenheit = (celsius * 1.8) + 32;

  Serial.print("celsius: ");
  Serial.print(celsius);
  Serial.println("C");

  Serial.print("fahrenheit: ");
  Serial.print(fahrenheit);
  Serial.println("F");

  // save fahrenheit (or celsius) to Adafruit IO
  temperature->save(fahrenheit);

  // temperature->save(celsius); // celcius ...

  dht.humidity().getEvent(&event);

  Serial.print("humidity: ");
  Serial.print(event.relative_humidity);
  Serial.println("%");

  // save humidity to Adafruit IO
  humidity->save(event.relative_humidity);

  // wait 5 seconds (5000 milliseconds == 5 seconds)
  delay(5000);

}
And here is the error message:

Code: Select all

Arduino: 1.8.13 (Mac OS X), Board: "Adafruit Feather M0, Small (-Os) (standard), Arduino, Off"

In file included from /Users/PhillipBriles/Electronics ƒ/Adafruit ƒ/Adafruit IO/AIO_sketch_may06d/AIO_sketch_may06d.ino:7:
/Users/PhillipBriles/Documents/Arduino/libraries/Adafruit_IO_Arduino/src/AdafruitIO_FONA.h:20:10: fatal error: SoftwareSerial.h: No such file or directory
   20 | #include <SoftwareSerial.h>
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board Adafruit Feather M0.
Thank you for any help provided.

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: No such file or directory ... compile error

Post by adafruit_support_carter »

Looks like that particular module is set to only use software serial. I'm not sure if there's a reason for that. Opened an issue for you here:
https://github.com/adafruit/Adafruit_IO ... issues/151

User avatar
_phillip
 
Posts: 313
Joined: Fri Apr 09, 2021 3:28 pm

Re: No such file or directory ... compile error

Post by _phillip »

adafruit_support_carter wrote:Looks like that particular module is set to only use software serial. I'm not sure if there's a reason for that. Opened an issue for you here:
https://github.com/adafruit/Adafruit_IO ... issues/151
Thanks for your help. I was really hoping to tie into IO today. Nothing like a smooth road in this business. Ha!

I sincerely appreciate your help.

User avatar
_phillip
 
Posts: 313
Joined: Fri Apr 09, 2021 3:28 pm

Re: No such file or directory ... compile error

Post by _phillip »

Something must not be working with regard to my computer. I say this because I can compile a sketch includes the SoftwareSerial.h lib, but I cannot compile another sketch that includes the very same library. And - the really strange thing is that this library does NOT exist as seen in the following screen grab:
Screen Shot 2021-05-06 at 9.28.53 PM.png
Screen Shot 2021-05-06 at 9.28.53 PM.png (462.48 KiB) Viewed 681 times
I have no idea what is causing this. I wish I knew how to resolve this.

Thanks!

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: No such file or directory ... compile error

Post by adafruit_support_carter »

Are you selecting different boards? Different boards can end up using different core libraries from different Board Support Packages. Some boards provide software serial support, some don't.

User avatar
_phillip
 
Posts: 313
Joined: Fri Apr 09, 2021 3:28 pm

Re: No such file or directory ... compile error

Post by _phillip »

adafruit_support_carter wrote:Are you selecting different boards? Different boards can end up using different core libraries from different Board Support Packages. Some boards provide software serial support, some don't.
No, I working exclusively on my Feather MO WiFi board

https://www.adafruit.com/product/3010

I just now setup my iMac (not my work computer) to determine if I would get a different result with the same exact sketch. I jumped through all the hoops to install the Adafruit Feather MO board(s) and when I compiled I got the same exact error message.

Here is my sketch:

Code: Select all

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

#include <DHT.h>
#include <DHT_U.h>

/*
 *    6 MAY 2021
 * 
 *    This sketch came from Adafruit IO here:
 *    
 *    https://learn.adafruit.com/adafruit-io-basics-temperature-and-humidity/arduino-code
 * 
 *    This will hopefully get me on AIO
 */
 
// pin connected to DH22 data line
#define DATA_PIN 2

// create DHT22 instance
DHT_Unified dht(DATA_PIN, DHT22);

// set up the 'temperature' and 'humidity' feeds
AdafruitIO_Feed *temperature = io.feed("temperature");
AdafruitIO_Feed *humidity = io.feed("humidity");


void setup() {

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

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

  // initialize dht22
  dht.begin();

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

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

//=========

  sensors_event_t event;
  dht.temperature().getEvent(&event);

  float celsius = event.temperature;
  float fahrenheit = (celsius * 1.8) + 32;

  Serial.print("celsius: ");
  Serial.print(celsius);
  Serial.println("C");

  Serial.print("fahrenheit: ");
  Serial.print(fahrenheit);
  Serial.println("F");

  // save fahrenheit (or celsius) to Adafruit IO
  temperature->save(fahrenheit);

  // temperature->save(celsius); // celcius ...

  //========

  dht.humidity().getEvent(&event);

  Serial.print("humidity: ");
  Serial.print(event.relative_humidity);
  Serial.println("%");

  // save humidity to Adafruit IO
  humidity->save(event.relative_humidity);

  // wait 5 seconds (5000 milliseconds == 5 seconds)
  delay(5000);

}
And here is the error message:

Code: Select all

Arduino: 1.8.13 (Mac OS X), Board: "Adafruit Feather M0, Small (-Os) (standard), Arduino, Off"

In file included from /Volumes/Data Rescue BootWell/Arduino/Compile Problems/AIO_sketch_may06d/AIO_sketch_may06d.ino:8:
/Users/PhillipBriles/Documents/Arduino/libraries/Adafruit_IO_Arduino/src/AdafruitIO_FONA.h:20:10: fatal error: SoftwareSerial.h: No such file or directory
   20 | #include <SoftwareSerial.h>
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board Adafruit Feather M0.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
And just for clarity here is grab of the libraries:
arduino-ide-libs.png
arduino-ide-libs.png (527.55 KiB) Viewed 661 times
I will remake this sketch and see if I get a different result. I am not calling the SoftwareSerial.h library, so I do no understand the error.

I sincerely appreciate your help.

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: No such file or directory ... compile error

Post by adafruit_support_carter »

It's being included by the library here:
https://github.com/adafruit/Adafruit_IO ... FONA.h#L20
But it fails because there is no SoftwareSerial for the Feather M0.

User avatar
_phillip
 
Posts: 313
Joined: Fri Apr 09, 2021 3:28 pm

Re: No such file or directory ... compile error

Post by _phillip »

adafruit_support_carter wrote:It's being included by the library here:
https://github.com/adafruit/Adafruit_IO ... FONA.h#L20
But it fails because there is no SoftwareSerial for the Feather M0.
Thank you for this information.

I commented out the <AdafruitIO_FONA.h> lib and got the following error msg:

Code: Select all

Arduino: 1.8.13 (Mac OS X), Board: "Adafruit Feather M0, Small (-Os) (standard), Arduino, Off"

AIO_sketch_may06d:36:32: error: 'io' was not declared in this scope
   36 | AdafruitIO_Feed *temperature = io.feed("temperature");
      |                                ^~
AIO_sketch_may06d:37:29: error: 'io' was not declared in this scope
   37 | AdafruitIO_Feed *humidity = io.feed("humidity");
      |                             ^~
/Volumes/Data Rescue BootWell/Arduino/Compile Problems/AIO_sketch_may06d/AIO_sketch_may06d.ino: In function 'void setup()':
AIO_sketch_may06d:53:3: error: 'io' was not declared in this scope
   53 |   io.connect();
      |   ^~
/Volumes/Data Rescue BootWell/Arduino/Compile Problems/AIO_sketch_may06d/AIO_sketch_may06d.ino: In function 'void loop()':
AIO_sketch_may06d:75:3: error: 'io' was not declared in this scope
   75 |   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.
So this begs the question: Are all of my errors happening because I am using the Feather MO board and not an ESPxxxx board?

While I would not be happy to have you say 'yes', that would at least bring some closure to these compile errors. I have an investment in several of these boards, but I need to move forward on my water tank level project.

The Adafruit example I have been trying to follow is this:

https://learn.adafruit.com/adafruit-io- ... d-humidity

This example uses the Adafruit Feather HUZZAH ESP8266. While I would be willing to switch boards, the question remains - why will the Feather MO WIFI not work for this project? Perhaps I just do not understand this issue at all??

Thanks again for your help.

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: No such file or directory ... compile error

Post by adafruit_support_carter »

Are all of my errors happening because I am using the Feather MO board and not an ESPxxxx board?
Yes. The ESP8266 has software serial.

The fix for this, for the Feather M0, would be to update the library to allow for use of hardware serial when it's available (and the only option). That's the basis of the issue opened up on Github.

User avatar
_phillip
 
Posts: 313
Joined: Fri Apr 09, 2021 3:28 pm

Re: No such file or directory ... compile error

Post by _phillip »

adafruit_support_carter wrote:
Are all of my errors happening because I am using the Feather MO board and not an ESPxxxx board?
Yes. The ESP8266 has software serial.

The fix for this, for the Feather M0, would be to update the library to allow for use of hardware serial when it's available (and the only option). That's the basis of the issue opened up on Github.
Thanks again for all of your help.

Would you recommend this board:
https://www.adafruit.com/product/3405

I need WIFI and have to tie into your IO site. If so, I will order several today.

I sincerely appreciate all of your help.

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: No such file or directory ... compile error

Post by adafruit_support_carter »

It's always hard to recommend a specific board. Everything has tradeoffs. The Feather ESP32 could be a good option. But you may run into some other quirk specific to your project once you start trying to incorporate it into your project. Best approach is to buy one and verify it works with your application before buying multiple.

User avatar
_phillip
 
Posts: 313
Joined: Fri Apr 09, 2021 3:28 pm

Re: No such file or directory ... compile error

Post by _phillip »

adafruit_support_carter wrote:It's always hard to recommend a specific board. Everything has tradeoffs. The Feather ESP32 could be a good option. But you may run into some other quirk specific to your project once you start trying to incorporate it into your project. Best approach is to buy one and verify it works with your application before buying multiple.
Glad I took a look back here - I have not received your reply yet. I had three(3) of the new HUZZAH32 in my basket. I will change that to a single board and test as you suggest.

Thanks for that good advice. I hope this board will work for this project.

Thank you very much for all of your help.

User avatar
_phillip
 
Posts: 313
Joined: Fri Apr 09, 2021 3:28 pm

Re: No such file or directory ... compile error

Post by _phillip »

adafruit_support_carter wrote:It's always hard to recommend a specific board. Everything has tradeoffs. The Feather ESP32 could be a good option. But you may run into some other quirk specific to your project once you start trying to incorporate it into your project. Best approach is to buy one and verify it works with your application before buying multiple.
Could you please remove the last post in this thread because it looks very much like spam or worse.

The poster is Tristanbiz and includes a link.

Thank you!

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”