I had most of my program and dashboard working great. Then something happened to cause the main loop to execute exactly three times, pause, and reboot. In addition, ArduinoCloud.connected() is always zero even though I see the message "Connected to GPRS Network" printed on the serial monitor. I have stripped down the program to the minimum and the same behavior exists.
Also, it is almost impossible to make changes and download the changed sketch because the board is constantly rebooting while the programming is taking place.
Any ideas? This is driving me crazy... Here is the stripped down code that does the same as my full code did:
/*
Sketch generated by the Arduino IoT Cloud Thing "GreenWater1"
https://create.arduino.cc/cloud/things/ce2b5a40-be10-4f62-a207-d3bc5e5058ef
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
String status;
int area1;
int area2;
int area3;
int boardO3analog;
int number1;
int number2;
int number3;
int prefix1;
int prefix2;
int prefix3;
int pressureOut;
int pressureVgas;
int pressureVin;
int pressureVout;
bool boardO3alarm;
bool savenumbers;
bool sendtesttextnow;
bool sendtext1;
bool sendtext2;
bool sendtext3;
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.
*/
#include "thingProperties.h"
int i = 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);
// 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();
}
void loop() {
ArduinoCloud.update();
// Your code here
Serial.print("\n(");
Serial.print(i);
Serial.print(") loopConnected= ");
Serial.print(ArduinoCloud.connected());
i++;
delay(500);
}
/*
Since Status is READ_WRITE variable, onStatusChange() is
executed every time a new value is received from IoT Cloud.
*/
void onStatusChange() {
// Add your code here to act upon Status change
Serial.print("Status=");
Serial.println(status);
}
/*
Since Area1 is READ_WRITE variable, onArea1Change() is
executed every time a new value is received from IoT Cloud.
*/
void onArea1Change() {
// Add your code here to act upon Area1 change
}
/*
Since Area2 is READ_WRITE variable, onArea2Change() is
executed every time a new value is received from IoT Cloud.
*/
void onArea2Change() {
// Add your code here to act upon Area2 change
}
/*
Since Area3 is READ_WRITE variable, onArea3Change() is
executed every time a new value is received from IoT Cloud.
*/
void onArea3Change() {
// Add your code here to act upon Area3 change
}
/*
Since Number1 is READ_WRITE variable, onNumber1Change() is
executed every time a new value is received from IoT Cloud.
*/
void onNumber1Change() {
// Add your code here to act upon Number1 change
}
/*
Since Number2 is READ_WRITE variable, onNumber2Change() is
executed every time a new value is received from IoT Cloud.
*/
void onNumber2Change() {
// Add your code here to act upon Number2 change
}
/*
Since Number3 is READ_WRITE variable, onNumber3Change() is
executed every time a new value is received from IoT Cloud.
*/
void onNumber3Change() {
// Add your code here to act upon Number3 change
}
/*
Since Prefix1 is READ_WRITE variable, onPrefix1Change() is
executed every time a new value is received from IoT Cloud.
*/
void onPrefix1Change() {
// Add your code here to act upon Prefix1 change
}
/*
Since Prefix2 is READ_WRITE variable, onPrefix2Change() is
executed every time a new value is received from IoT Cloud.
*/
void onPrefix2Change() {
// Add your code here to act upon Prefix2 change
}
/*
Since Prefix3 is READ_WRITE variable, onPrefix3Change() is
executed every time a new value is received from IoT Cloud.
*/
void onPrefix3Change() {
// Add your code here to act upon Prefix3 change
}
/*
Since Savenumbers is READ_WRITE variable, onSavenumbersChange() is
executed every time a new value is received from IoT Cloud.
*/
void onSavenumbersChange() {
// Add your code here to act upon Savenumbers change
}
/*
Since Sendtesttextnow is READ_WRITE variable, onSendtesttextnowChange() is
executed every time a new value is received from IoT Cloud.
*/
void onSendtesttextnowChange() {
// Add your code here to act upon Sendtesttextnow change
}
/*
Since Sendtext1 is READ_WRITE variable, onSendtext1Change() is
executed every time a new value is received from IoT Cloud.
*/
void onSendtext1Change() {
// Add your code here to act upon Sendtext1 change
}
/*
Since Sendtext2 is READ_WRITE variable, onSendtext2Change() is
executed every time a new value is received from IoT Cloud.
*/
void onSendtext2Change() {
// Add your code here to act upon Sendtext2 change
}
/*
Since Sendtext3 is READ_WRITE variable, onSendtext3Change() is
executed every time a new value is received from IoT Cloud.
*/
void onSendtext3Change() {
// Add your code here to act upon Sendtext3 change
}