I keep getting this error when compiling the code that I copied and pasted from this link:
https://create.arduino.cc/projecthub/adriensales/legacy-mailbox-sms-notifier-ec6d4b
HERE IS THE CODE::
#include "arduino_secrets.h"
/*
Sketch generated by the Arduino IoT Cloud Thing "MAILBOX"
https://create.arduino.cc/cloud/things/9b41adac-e48d-428e-9ccd-0dddd50c4be5
Arduino IoT Cloud Properties description
The following variables are automatically generated and updated when changes are made to the Thing properties
int deliveries;
Properties 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.
*/
#include "thingProperties.h"
// PIN configuration
const int trigPin = 6; // Trigger
const int echoPin = 7; // Echo
// variables
long duration, cm, inches;
int prev_cm = 30;
int curr_cm = 30;
int prev_status = 0;
int curr_status = 0;// out
int zone_radius_cm = 10;
int nb_current_deliveries = 0;// number of times an input has been detected
int nb_previous_deliveries = 0;
int loop_counter = 0;
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
Serial.println("Booting Mailbox scanner...");
delay(200);
// Defined in thingProperties.h
initProperties();
setDebugMessageLevel(4);
ArduinoCloud.printDebugInfo();
// 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
*/
deliveries = 0;
//Define inputs and outputs
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
// some led pight
pinMode(LED_BUILTIN, OUTPUT);
Serial.println("Mailbox scanner booted.");
}
void loop() {
ArduinoCloud.update(); //HERE IS THE ERROR
// Your code here
if (nb_current_deliveries > nb_previous_deliveries){
Serial.println("Watching inbox...");
}
// The sensor is triggered by a HIGH pulse of 10 or more microseconds.
// Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
digitalWrite(trigPin, LOW);
delayMicroseconds(5);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Read the signal from the sensor: a HIGH pulse whose
// duration is the time (in microseconds) from the sending
// of the ping to the reception of its echo off of an object.
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);
// Convert the time into a distance
cm = (duration/2) / 29.1; // Divide by 29.1 or multiply by 0.0343
//inches = (duration/2) / 74; // Divide by 74 or multiply by 0.0135
prev_cm = curr_cm;
curr_cm = cm;
prev_status = curr_status;
//Serial.print(inches);
//Serial.print("in, ");
//Serial.print(cm);
//Serial.print("cm");
//Serial.println();
if (curr_cm < zone_radius_cm){
// object in the zone
Serial.println("");
Serial.println("Object in the zone !");
// Increase nb. of deliveries
nb_previous_deliveries = nb_current_deliveries;
nb_current_deliveries++;
// update deliveries for cloud counter
deliveries++;
//ack = false;
Serial.println("Acknowledge flag reset to false.");
notify();
Serial.println("Sleeping for a while now...");
delay(3000);
//prev_status = curr_status;
curr_status = 1;
}
else {
nb_previous_deliveries = nb_current_deliveries;
if(loop_counter == 0){
Serial.println();
}
Serial.print(".");
//"Serial.println("No activity in the zone, watching moves...");
delay(100); // Wait for 100 millisecond(s)
}
delay(100);
loop_counter++;
loop_counter = loop_counter % 25;
}
/////////////////////////////////////////////////////////////////////////////
//
// Custom functions
void notify(){
Serial.println("Notifying...");
//digitalWrite(LED_BUILTIN, HIGH);
Serial.print("<");
Serial.print(nb_current_deliveries);
Serial.println("> total deliveries.");
//delay(10000);
Serial.println("Notified.");
Serial.println("#################################");
//digitalWrite(LED_BUILTIN, LOW);
int i = 0;
while ( i < 20){
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(200); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(200);
i++;
}
}
and here is the full error message
Arduino: 1.8.15 (Mac OS X), Board: "Arduino MKR1000"
In file included from /Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/MAILBOX_notifier.ino:18:0:
/Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/thingProperties.h: In function 'void initProperties()':
thingProperties.h:13:3: error: 'ArduinoCloud' was not declared in this scope
ArduinoCloud.setThingId(THING_ID);
^~~~~~~~~~~~
/Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/thingProperties.h:13:3: note: suggested alternative: 'Arduino_h'
ArduinoCloud.setThingId(THING_ID);
^~~~~~~~~~~~
Arduino_h
thingProperties.h:14:28: error: 'deliveries' was not declared in this scope
ArduinoCloud.addProperty(deliveries, READ, ON_CHANGE, NULL);
^~~~~~~~~~
/Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/thingProperties.h:14:28: note: suggested alternative: 'Deliveries'
ArduinoCloud.addProperty(deliveries, READ, ON_CHANGE, NULL);
^~~~~~~~~~
Deliveries
thingProperties.h:14:40: error: 'READ' was not declared in this scope
ArduinoCloud.addProperty(deliveries, READ, ON_CHANGE, NULL);
^~~~
thingProperties.h:14:46: error: 'ON_CHANGE' was not declared in this scope
ArduinoCloud.addProperty(deliveries, READ, ON_CHANGE, NULL);
^~~~~~~~~
/Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/thingProperties.h:14:46: note: suggested alternative: 'CHANGE'
ArduinoCloud.addProperty(deliveries, READ, ON_CHANGE, NULL);
^~~~~~~~~
CHANGE
/Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/thingProperties.h: At global scope:
thingProperties.h:17:1: error: 'ConnectionManager' does not name a type
ConnectionManager *ArduinoIoTPreferredConnection = new WiFiConnectionManager(SSID, PASS);
^~~~~~~~~~~~~~~~~
/Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/MAILBOX_notifier.ino: In function 'void setup()':
MAILBOX_notifier:49:3: error: 'setDebugMessageLevel' was not declared in this scope
setDebugMessageLevel(4);
^~~~~~~~~~~~~~~~~~~~
MAILBOX_notifier:50:3: error: 'ArduinoCloud' was not declared in this scope
ArduinoCloud.printDebugInfo();
^~~~~~~~~~~~
/Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/MAILBOX_notifier.ino:50:3: note: suggested alternative: 'Arduino_h'
ArduinoCloud.printDebugInfo();
^~~~~~~~~~~~
Arduino_h
MAILBOX_notifier:53:22: error: 'ArduinoIoTPreferredConnection' was not declared in this scope
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MAILBOX_notifier:62:2: error: 'deliveries' was not declared in this scope
deliveries = 0;
^~~~~~~~~~
/Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/MAILBOX_notifier.ino:62:2: note: suggested alternative: 'Deliveries'
deliveries = 0;
^~~~~~~~~~
Deliveries
/Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/MAILBOX_notifier.ino: In function 'void loop()':
MAILBOX_notifier:75:3: error: 'ArduinoCloud' was not declared in this scope
ArduinoCloud.update();
^~~~~~~~~~~~
/Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/MAILBOX_notifier.ino:75:3: note: suggested alternative: 'Arduino_h'
ArduinoCloud.update();
^~~~~~~~~~~~
Arduino_h
MAILBOX_notifier:118:5: error: 'deliveries' was not declared in this scope
deliveries++;
^~~~~~~~~~
/Users/Daniel/Downloads/adriens-MAILBOX_notifier-7c1ccba/MAILBOX_notifier/MAILBOX_notifier.ino:118:5: note: suggested alternative: 'Deliveries'
deliveries++;
^~~~~~~~~~
Deliveries
exit status 1
'ArduinoCloud' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
ANY HELP IS/WOULD BE APPRECIATED