commit 9432cc9c4ff4230541205b82c76b02a900fa838f Author: Darks Date: Fri Jul 3 19:32:29 2020 +0200 WIP diff --git a/Webcalc.ino b/Webcalc.ino new file mode 100644 index 0000000..b678c2e --- /dev/null +++ b/Webcalc.ino @@ -0,0 +1,79 @@ +/** + BasicHTTPSClient.ino + + Created on: 20.08.2018 + +*/ + +#include + +#include +#include + +#include + +#include +// Fingerprint for demo URL, expires on June 2, 2021, needs to be updated well before this date +const uint8_t fingerprint[20] = {0xCF, 0xAC, 0xAE, 0x63, 0x39, 0xEA, 0x75, 0xDB, 0x28, 0xB9, 0xD9, 0x6D, 0x1B, 0xF3, 0x0F, 0xFE, 0xAF, 0x26, 0xEB, 0xE6}; + +ESP8266WiFiMulti WiFiMulti; + +void setup() { + + Serial.begin(115200); + // Serial.setDebugOutput(true); + + Serial.println(); + Serial.println(); + Serial.println(); + + for (uint8_t t = 4; t > 0; t--) { + Serial.printf("[SETUP] WAIT %d...\n", t); + Serial.flush(); + delay(1000); + } + + WiFi.mode(WIFI_STA); + WiFiMulti.addAP("SSID", "PASSWORD"); +} + +void loop() { + // wait for WiFi connection + if ((WiFiMulti.run() == WL_CONNECTED)) { + + std::unique_ptrclient(new BearSSL::WiFiClientSecure); + + client->setFingerprint(fingerprint); + + HTTPClient https; + + Serial.print("[HTTPS] begin...\n"); + if (https.begin(*client, "https://www.planet-casio.com/Fr/shoutbox/api/read?since=1762387&channel=dev")) { // HTTPS + + Serial.print("[HTTPS] GET...\n"); + // start connection and send HTTP header + int httpCode = https.GET(); + + // httpCode will be negative on error + if (httpCode > 0) { + // HTTP header has been send and Server response header has been handled + Serial.printf("[HTTPS] GET... code: %d\n", httpCode); + + // file found at server + if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) { + String payload = https.getString(); + Serial.println(payload); + } + } else { + Serial.printf("[HTTPS] GET... failed, error: %s\n", https.errorToString(httpCode).c_str()); + } + + https.end(); + } else { + Serial.printf("[HTTPS] Unable to connect\n"); + } + } + + Serial.println("Wait 10s before next round..."); + delay(10000); +} diff --git a/at_basic.cpp b/at_basic.cpp new file mode 100644 index 0000000..6ca44f7 --- /dev/null +++ b/at_basic.cpp @@ -0,0 +1,24 @@ +#include + +#include + +// AT: test startup +void at() { + Serial.println("") +} + +void at_rst() { + +} + +void at_gmr() { + +} + +void at_gslp() { + +} + +void ate() { + +}