No Such File Error

I'm working on the IoT cloud, creating a data logger which measures on a Mega (due to the amount of inputs) Sends it by serial to a MKR 1400 GSM and transmits to the IoT dashboard. I have got the MEGA side working fine and measuring fine, however using the same libraries to set up the receiving side on the IoT board is giving me this error

Start verifying
/home/builder/opt/libraries/latest/dabble_1_5_2/src/SoftwareSerial.cpp:45:10: fatal error: util/delay_basic.h: No such file or directory
#include <util/delay_basic.h>
^~~~~~~~~~~~~~~~~~~~
compilation terminated.
Error during build: exit status 1

/home/builder/opt/libraries/latest/dabble_1_5_2/src/SoftwareSerial.cpp:45:10: fatal error: util/delay_basic.h: No such file or directory
#include <util/delay_basic.h>
^~~~~~~~~~~~~~~~~~~~
compilation terminated.
Error during build: exit status 1

This is the code,any ideas?

#include "thingProperties.h"


#include <ArduinoJson.h>
#include <SoftwareSerial.h>
/* 
  Sketch generated by the Arduino IoT Cloud Thing "Untitled 2"
  https://create.arduino.cc/cloud/things/6d0c887d-ed92-4e14-b770-4355eba31b33 

  Arduino IoT Cloud Variables description

  The following variables are automatically generated and updated when changes are made to the Thing

  float c1;
  float c2;
  float c3;
  float input_0;
  float input_0_logR2;
  float input_0_R2;
  float input_0_T;
  float input_0_Tc;
  float input_0_Tf;
  float r1;

  Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
  which are called when their values are changed from the Dashboard.
  These functions are generated with the Thing and added at the end of this sketch.
*/




SoftwareSerial linkSerial(5, 4); // RX, TX

void setup() {


  // Defined in thingProperties.h
  initProperties();

  // Connect to Arduino IoT Cloud
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);
  
  /*
     The following function allows you to obtain more information
     related to the state of network and IoT Cloud connection and errors
     the higher number the more granular information you’ll get.
     The default is 0 (only errors).
     Maximum is 4
 */
  setDebugMessageLevel(2);
  ArduinoCloud.printDebugInfo();
  
  float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
  float r1 = 10000;
  pinMode(A1, INPUT);
  
  
  // Initialize "debug" serial port
  // The data rate must be much higher than the "link" serial port
  Serial.begin(115200);
  while (!Serial) continue;

  // Initialize the "link" serial port
  // Use the lowest possible data rate to reduce error ratio
  linkSerial.begin(4800);
}

void loop() {
  ArduinoCloud.update();
  // Your code here 
  //input_0 = analogRead(A1);
    
  //float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
  //float r1 = 10000;  
  //input_0_R2 = r1 * (1023.0 / input_0 - 1.0);
  //input_0_logR2 = log(input_0_R2);
  //input_0_T = (1.0 / (c1 + (c2*input_0_logR2) + (c3*input_0_logR2*input_0_logR2*input_0_logR2)));
  //input_0_Tc = input_0_T - 273.15;
 
  //Serial.println(input_0);
  //Serial.println(input_0_R2);
  //Serial.println(input_0_logR2);
  //Serial.println(input_0_T);
  //Serial.println("Temperature Input 0: "); 
  //Serial.print(input_0_Tc);
  //Serial.print(" C");   
  
  //delay(1000);
  

  // Check if the other Arduino is transmitting
  if (linkSerial.available()) 
  {
    // Allocate the JSON document
    // This one must be bigger than for the sender because it must store the strings
    StaticJsonDocument<300> doc;

    // Read the JSON document from the "link" serial port
    DeserializationError err = deserializeJson(doc, linkSerial);

    if (err == DeserializationError::Ok) 
    {
      // Print the values
      // (we must use as<T>() to resolve the ambiguity)
      Serial.print("input_0_Tc = ");
      Serial.println(doc["input_0_Tc"].as<float>());
  
    } 
    else 
    {
      // Print error to the "debug" serial port
      Serial.print("deserializeJson() returned ");
      Serial.println(err.c_str());
  
      // Flush all bytes in the "link" serial port buffer
      while (linkSerial.available() > 0)
        linkSerial.read();
    }
  }
  
  
  
  
}

this does not sound like a typical directory for the libraries

I haven't changed anything in the IoT Cloud sketch area,I have made sketches previously on here that has worked fine

OK - I'm not familiar with those paths.

curious also why you use SoftwareSerial on your MKR 1400 GSM as it has an extra hardware Serial port ( USB connector provides a virtual serial port using the Serial object and Serial1 is a Hardware Serial port on pins 13/14)

I can switch it over, but aside from that I can't seem to figure out the error that it is giving me

it tells you that it can't find the path to util/delay_basic.h
this could be due to a non standard location of the libraries and the weird way the Arduino IDE looks for code

The library paths on Arduino Create are documented (somewhat incidentally) here:

https://arduino.github.io/arduino-cli/latest/sketch-build-process/#location-priorities-in-arduino-web-editor

  • Libraries listed under Libraries > Library Manager.
  • These libraries are under /home/builder/opt/libraries/latest

So all the >4500 libraries of the Arduino Library Manager are installed under that folder. This approach of having all the libraries pre-installed greatly increases the chance for unexpected library discovery behavior.

Since the official SoftwareSerial library is a "platform bundled library" which is not bundled with the "Arduino SAMD (32-bits ARM Cortex-M0+) Boards" platform, we would normally expect compiling this code for the MKR GSM 1400 to fail with an error like:

SomeSketch.ino:1:10: fatal error: SoftwareSerial.h: No such file or directory
 #include <SoftwareSerial.h>
          ^~~~~~~~~~~~~~~~~~
compilation terminated.

Compilation error: exit status 1

However, there happens to be a library named "Dabble" in the Library Manager which contains a file named SoftwareSerial.h. So the library discovery process finds this random library which surely @dominicso did not intend to use, and we get this somewhat confusing error message about a path from avr-libc.

1 Like

good explanation

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.