http://www.lineameteo.it/viewtopic.php?f=2&t=15903&p=465940#p465940 ----------------------------------- As_Needed Dom 02 Set, 2018 03:14 Re: Stazione Meteo A Melbourne Per Lineameteo! ----------------------------------- Okay intanto ho aggiornato il codice dopo diversi problemi, e ho inserito nella stringa dei dati richiesti la data e l'orario, richiesti tramite un server NTP Questo è il nuovo link http://weatherclayton.ddns.net:4700/ Adesso manca di acquistare il preciso SHT35 e testarlo ;) Questo per il momento è il brutto codice che uso :D Lo devo ordinare molto molto meglio [spoiler]#include #include #include #include #include #include #include #include #include // Define NTP properties #define NTP_OFFSET 60 * 60 // In seconds #define NTP_INTERVAL 60 * 1000 // In miliseconds #define NTP_ADDRESS "209.115.181.107" // "ca.pool.ntp.org" // change this to whatever pool is closest (see ntp.org) #define CALIBRATION 850 // Set up the NTP UDP client WiFiUDP ntpUDP; NTPClient timeClient(ntpUDP, NTP_ADDRESS , NTP_OFFSET, NTP_INTERVAL); WiFiServer server(80); IPAddress ip(10, 0, 0, 140); IPAddress gateway(10, 0, 0, 138); IPAddress subnet (255 , 255, 255, 0); const char* ssid = "Internet Name"; // Your ssid const char* password = "Internet Password"; // Your Password String date; String t; const char * days[] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"} ; const char * months[] = {"Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sep", "Oct", "Nov", "Dec"} ; Adafruit_BMP085 bmp; byte giornoSalvato; // variabile per memorizzare lo stato del giorno attuale float minTemp; float maxTemp; void setup () { Serial.begin(115200); // most ESP-01's use 115200 but this could vary timeClient.begin(); // Start the NTP UDP client server.begin(); maxTemp = -100; minTemp = 100; // Connect to wifi Serial.println(""); Serial.print("Connecting to "); Serial.print(ssid); WiFi.config(ip, gateway, subnet); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.print("Connected to WiFi at "); Serial.print(WiFi.localIP()); Serial.println(""); delay(1000); giornoSalvato = 0; Wire.pins(4, 5); // NodeMCU v1.0 SDA=>D2 SCL=>D1 Wire.begin(); // Initialize the sensor (it is important to get calibration values stored on the device). bmp.begin(); } void loop() { float pressure = bmp.readPressure() + CALIBRATION; float pressurehpa = pressure / 100; float tp = bmp.readTemperature(); if (minTemp < tp) { minTemp = tp; } if (maxTemp > tp) { maxTemp = tp; } date = ""; // clear the variables t = ""; // update the NTP client and get the UNIX UTC timestamp timeClient.update(); unsigned long epochTime = timeClient.getEpochTime(); // convert received time stamp to time_t object time_t local, utc; utc = epochTime; // Then convert the UTC UNIX timestamp to local time TimeChangeRule usEDT = {"EDT", First, Sun, Apr, 2, +540}; //UTC - 5 hours - change this as needed TimeChangeRule usEST = {"EST", First, Sun, Oct, 2, +600}; //UTC - 6 hours - change this as needed Timezone usEastern(usEDT, usEST); local = usEastern.toLocal(utc); /*date += days[weekday(local)-1]; date += ", ";*/ if (day(local) < 10) // add a zero if minute is under 10 date += "0"; date += day(local); date += "/"; if (month(local) < 10) // add a zero if minute is under 10 date += "0"; date += month(local); date += "/"; date += year(local); if (hour(local) < 10) // add a zero if minute is under 10 t += "0"; t += hour(local); t += ":"; if (minute(local) < 10) // add a zero if minute is under 10 t += "0"; t += minute(local); t += ":"; if (second(local) < 10) // add a zero if minute is under 10 t += "0"; t += second(local);/* t += " "; t += ampm[isPM(local)];*/ if (giornoSalvato != day(local)) { giornoSalvato = day(local); Serial.println(giornoSalvato); maxTemp = tp; minTemp = tp; } // Display the date and time /* Serial.println(""); Serial.print("Local date: "); Serial.print(date); Serial.println(""); Serial.print("Local time: "); Serial.print(t);*/ WiFiClient client = server.available(); client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println("Connection: close"); client.println(); client.println(""); client.println(""); client.print(date); client.print(" "); client.print(t); client.print("&v0=-37.938906&v0=145.129615&v0=Clayton South(VIC)&v0=52m s.l.m.&v0="); client.print(tp, 1); client.print("&v0="); client.print("UMIDITA"); client.print("&v0="); client.print(pressurehpa, 1); client.print("&v0="); client.print("ND"); client.print("&v0="); client.print("ND"); client.print("&v0="); client.print("ND"); client.print("&v0="); client.print(minTemp, 1); client.print("&v0="); client.print(maxTemp, 1); client.print("&v0="); client.print("ND"); client.print("&v0="); client.print("ND"); client.println(""); }[/spoiler]