I have a simple program - I’m trying to just log some temperatrues from a sensor, and saw saveStrings() is a thing. However, it throws an error, “Compilation error: saveStrings’ was not declared in this scope.
Here’s the code (and I also have temperature.txt saved in the program folder.
#include <Adafruit_MLX90614.h>
#define LED 13
const int piezoPin = 8;
String temp = "test";
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
void setup() {
Serial.begin(9600);
pinMode(LED, OUTPUT);
while (!Serial);
if (!mlx.begin()) {
Serial.println("Error connecting to MLX sensor. Check wiring.");
while (1);
};
}
void loop() {
// Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempC());
// Serial.print("*C\tObject = "); Serial.print(mlx.readObjectTempC()); Serial.println("*C");
Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempF());
Serial.print("*F\tObject = "); Serial.print(mlx.readObjectTempF()); Serial.println("*F");
temp = mlx.readObjectTempF();
// ERROR IS ON THE BELOW LINE
saveStrings("temperature.txt", temp);
Serial.println();
if(mlx.readObjectTempF() > 80){
digitalWrite(LED, HIGH);
tone(piezoPin, 1000, 100);
digitalWrite(piezoPin, LOW);
} else {
digitalWrite(LED, LOW);
// notone(piezoPin);
digitalWrite(piezoPin, HIGH);
}
// delay(500);
delay(60000); // delay 1 minute
}
I can’t see why, the example on the Arduino page is quite simple?