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