I've had some limited success.
I went to my Arduino Cloud Sketches at https://app.arduino.cc/sketches
There I found that 2 new sketches had appeared: Weather_Report_aug21a and Weather_Report_aug21b
Weather_Report_aug21b had 3 tabs:
Weather_Report_aug21b.ino, thingProperties.h and Sketch Secrets.
Weather_Report_aug21a only had 2 tabs. Sketch Secrets was missing.
So I concentrated on Weather_Report_aug21b.
When I inspected 'Sketch Secrets' it did not look like the 'Sketch Secrets' that I had seen in other working sketches.
This is what it should have have looked like:
I clicked on the 'ADD NEW' button and manually entered the correct details:
I'll delete the erroneous entry later on.
When I tried to compile the code, there were errors.
Unfortunately I don't have a screenshot with the errors on, or the error message itself.
Here is the code that was created:
Weather_Report_aug21b.ino
#include "arduino_secrets.h"
#include <WiFiS3.h>
#include <ArduinoJson.h>
#include <ArduinoHttpClient.h>
#include "thingProperties.h"
#include <Arduino_LED_Matrix.h>
#include <Arduino_CloudConnectionFeedback.h>
ArduinoLEDMatrix matrix;
// Number that sets how many days of forecasts that are collected
const int numOfForecasts = 7;
double temperatureMax[numOfForecasts];
double temperatureMin[numOfForecasts];
int weather[numOfForecasts];
void setup() {
Serial.begin(9600);
delay(1500);
matrix.begin();
// Defined in thingProperties.h
initProperties();
// Connect to Arduino Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
waitForArduinoCloudConnection(matrix);
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
int status = WL_IDLE_STATUS;
WiFi.begin(SSID, PASS);
delay(1000);
status = WiFi.status();
// Set location of weather forecasts
//and display location on the cloud dashboard
weatherLocation = Location(latitude, longitude);
getWeatherData();
}
void loop() {
ArduinoCloud.update();
}
void getWeatherData() {
int httpPort = 80;
char serverAddress[] = "api.open-meteo.com"; // server address
WiFiClient wifi;
HttpClient client = HttpClient(wifi, serverAddress, httpPort);
// This loop will look through the JSON response and find the lines
// that contain the temperature and weather codes,
// which will then be placed in arrays so they can be easily accessed
client.get("/v1/forecast?latitude=" + String(latitude) + "&longitude=" + String(longitude) + "¤t=temperature_2m,weather_code&daily=weather_code,temperature_2m_max,temperature_2m_min&timezone=Europe%2FBerlin");
unsigned long timeout = millis();
while (client.available() == 0) {
if (millis() - timeout > 5000) {
client.stop();
return;
}
}
int statusCode = client.responseStatusCode();
// The entire response from the API in JSON is then stored in "result"
String result = client.responseBody();
// To only get the information that is needed, the JSON response will be parsed using a parsing function
parseWeatherData(result);
}
void parseWeatherData(const String& json) {
StaticJsonDocument<7000> doc;
deserializeJson(doc, json);
// This loop will look through the JSON response and find the lines
// that contain the temperature and weather codes,
// which will then be placed in arrays so they can be easily accessed
for (int i = 0; i < numOfForecasts; i++) {
temperatureMax[i] = doc["daily"]["temperature_2m_max"][i];
temperatureMin[i] = doc["daily"]["temperature_2m_min"][i];
weather[i] = doc["daily"]["weather_code"][i];
}
}
void onLongitudeChange(){
getWeatherData();
weatherLocation = Location(latitude, longitude);
}
void onLatitudeChange(){
getWeatherData();
weatherLocation = Location(latitude, longitude);
}
void onDayChange() {
}
void onForecastScheduleChange() {
}
/*
Since Latitude is READ_WRITE variable, onLatitudeChange() is
executed every time a new value is received from IoT Cloud.
*/
void onLatitudeChange() {
// Add your code here to act upon Latitude change
}
/*
Since Longitude is READ_WRITE variable, onLongitudeChange() is
executed every time a new value is received from IoT Cloud.
*/
void onLongitudeChange() {
// Add your code here to act upon Longitude change
}
thingProperties.h
// Code generated by Arduino IoT Cloud, DO NOT EDIT.
#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>
const char SSID[] = SECRET_SSID; // Network SSID (name)
const char PASS[] = SECRET_OPTIONAL_PASS; // Network password (use for WPA, or use as key for WEP)
void onLatitudeChange();
void onLongitudeChange();
void onDayChange();
void onForecastScheduleChange();
float latitude;
float longitude;
int day;
CloudLocation weatherLocation;
CloudSchedule forecastSchedule;
void initProperties(){
ArduinoCloud.addProperty(latitude, READWRITE, ON_CHANGE, onLatitudeChange);
ArduinoCloud.addProperty(longitude, READWRITE, ON_CHANGE, onLongitudeChange);
ArduinoCloud.addProperty(day, READWRITE, ON_CHANGE, onDayChange);
ArduinoCloud.addProperty(weatherLocation, READ, ON_CHANGE, NULL);
ArduinoCloud.addProperty(forecastSchedule, READWRITE, ON_CHANGE, onForecastScheduleChange);
}
WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);
Sketch Secrets
#define SECRET_moto_e_13_ ""
// this is the erroneous arduino_secrets.h
// as generated by the Arduino Cloud.
The errors were due to void onLatitudeChange() and void onLongitudeChange() in the .ino file being defined twice.
I commented out the second definition and retried the compiling.
Success at last:
Now I have the following Dashboard:
I've got a nice new dashboard, but it does not get populated with any data.
![]()
I don't know whether the errors that the Arduino Cloud introduced were peculiar to me , or whether @d2v5d will have exactly the same faults.
@mario-r , I don't think that someone new to Arduino would stand any chance of finding the errors that i did.





