#include #include #include #define SCK_PIN 0 #define CS_PIN 4 #define SO_PIN 5 MAX6675_Thermocouple* thermocouple = NULL; const char* ssid = "wifimeno"; const char* password = "wifiheslo"; const char* host = "smidmartin.cz"; //without https and without www const int httpsPort = 443; const char* fingerprint = "87 b3 72 1d 6f 32 b2 27 05 2f 78 e4 99 ec c0 99 0d 02 da 5d"; //sha1 fingerprint of HTTPS certificate void setup() { thermocouple = new MAX6675_Thermocouple(SCK_PIN, CS_PIN, SO_PIN); Serial.begin(9600); Serial.println(); Serial.print("Pripojuji se na: "); Serial.println(ssid); WiFi.mode(WIFI_STA); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi pripojeno"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); } void loop() { while (WiFi.status() != WL_CONNECTED) { WiFi.begin(ssid, password); delay(500); Serial.print("."); } const double celsius = thermocouple->readCelsius(); String teplota = String(celsius); WiFiClientSecure client; if (client.verify(fingerprint, host)) {} else {} if (client.connect(host, httpsPort)) { String url = "/data.php?teplota="+teplota; client.print(String("GET ") + url + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "User-Agent: NodeMCU\r\n" + "Connection: close\r\n\r\n"); }else if (!client.connect(host, httpsPort)) { Serial.println("Connection unsucesssful"); } }