diff --git a/libraries/Firebase/Firebase.cpp b/Firebase.cpp similarity index 100% rename from libraries/Firebase/Firebase.cpp rename to Firebase.cpp diff --git a/libraries/Firebase/Firebase.h b/Firebase.h similarity index 100% rename from libraries/Firebase/Firebase.h rename to Firebase.h diff --git a/README.md b/README.md index c1ab6f1a..27e30945 100644 --- a/README.md +++ b/README.md @@ -6,26 +6,16 @@ This sample show how to call firebase from an arduino sketch. ## Requirements -- 1 esp8266 -- 1 attiny85 -- 1 push button +- 1 Arduino compatible esp8266 board. - Arduino 1.6.x ## Setup -- Update `ssid` and `host` variable in `firebase.ino`. -- Flash `firebase.ino` on the esp8266. -- Flash `button.ino` on the attiny85. -- Connect attiny softserial(0,1) on esp8266 rx/tx. - -## Provision -- Generate a firebase token. -- Send the following command over serial port on the esp8266: -``` -TOKEN -``` +- Clone the repo in your Arduino libraries directory. +- open the `FirebasePush_ESP8266` example. +- Update `WIFI_SSID` `WIFI_PASSWORD` `FIREBASE_HOST` `FIREBASE_TOKEN` constant. ## Run -- Open firebase dashboard on `/hits.json`. -- Press the button. +- Open firebase dashboard on `/logs.json`. +- Power up the arduino board. - Notice the new entry. diff --git a/button_attiny/button_attiny.ino b/button_attiny/button_attiny.ino deleted file mode 100644 index 74402878..00000000 --- a/button_attiny/button_attiny.ino +++ /dev/null @@ -1,39 +0,0 @@ -// -// Copyright 2015 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#include - -SoftwareSerial mySerial(1, 0); // RX, TX -int pushButton = 2; - -void setup() { - mySerial.begin(115200); - mySerial.println("hello"); - pinMode(pushButton, INPUT); - digitalWrite(pushButton, HIGH); -} - -int previousState = 1; - - -void loop() { - int buttonState = digitalRead(pushButton); - if (buttonState == 0 && buttonState != previousState) { - mySerial.println("POST /hits.json"); - mySerial.println("{\".sv\": \"timestamp\"}"); - } - previousState = buttonState; -} diff --git a/design/tiny/README.md b/design/tiny/README.md deleted file mode 100644 index db170e95..00000000 --- a/design/tiny/README.md +++ /dev/null @@ -1,33 +0,0 @@ -Fritzing Design -=============== - -![design](https://github.com/googlesamples/firebase-iot-button/raw/master/design/tiny/tiny.png) - -Bill of Materials -================= - -Assembly List -------------- - -| Label | Part Type | Properties | -|-------|-------------------|-----------------------------------------------------------------------| -| LED1 | Red (633nm) LED | package 3 mm [THT]; leg yes; color Red (633nm) | -| LED2 | Green (560nm) LED | package 3 mm [THT]; leg yes; color Green (560nm) | -| S1 | Pushbutton | package [SMD] | -| U1 | NodeMCU V1.0 | chip ESP8266; variant NodeMCUV1 | -| U2 | attiny85 | package dip; version Attiny85-20PU; type Atmel AVR; variant dip08 THT | -| U3 | Battery Holders | package battery-aaa; variant aaa | -| U4 | Battery Holders | package battery-aaa; variant aaa | -| U5 | Battery Holders | package battery-aaa; variant aaa | - -Shopping List -------------- - -| Amount | Part Type | Properties | -|--------|-------------------|-----------------------------------------------------------------------| -| 1 | Red (633nm) LED | package 3 mm [THT]; leg yes; color Red (633nm) | -| 1 | Green (560nm) LED | package 3 mm [THT]; leg yes; color Green (560nm) | -| 1 | Pushbutton | package [SMD] | -| 1 | NodeMCU V1.0 | chip ESP8266; variant NodeMCUV1 | -| 1 | attiny85 | package dip; version Attiny85-20PU; type Atmel AVR; variant dip08 THT | -| 3 | Battery Holders | package battery-aaa; variant aaa | diff --git a/design/tiny/tiny.fz b/design/tiny/tiny.fz deleted file mode 100644 index 15618c90..00000000 --- a/design/tiny/tiny.fz +++ /dev/null @@ -1,3250 +0,0 @@ - - - - - - - - - - - - - - - - PCB1 - - - - - - - - - - - - - - U1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - U2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - S1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - LED1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - LED2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Wire31 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Wire50 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - U3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - U4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - U5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Wire79 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Wire82 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Wire85 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Wire88 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Wire187 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Wire216 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Bread1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Wire267 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Wire328 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Wire339 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Wire354 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Wire361 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/design/tiny/tiny.png b/design/tiny/tiny.png deleted file mode 100644 index 1a894236..00000000 Binary files a/design/tiny/tiny.png and /dev/null differ diff --git a/design/tiny/tiny.svg b/design/tiny/tiny.svg deleted file mode 100644 index 4805f326..00000000 --- a/design/tiny/tiny.svg +++ /dev/null @@ -1,2716 +0,0 @@ - - - - - - - - - - - - - - - - - 1 - - - 5 - - - 10 - - - 15 - - - 20 - - - 25 - - - 30 - - - 1 - - - 5 - - - 10 - - - 15 - - - 20 - - - 25 - - - 30 - - - A - - - B - - - C - - - D - - - E - - - F - - - G - - - H - - - I - - - J - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AAA Battery - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AAA Battery - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AAA Battery - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - \ No newline at end of file diff --git a/libraries/Firebase/examples/FirebasePush_ESP8266/FirebasePush_ESP8266.ino b/examples/FirebasePush_ESP8266/FirebasePush_ESP8266.ino similarity index 100% rename from libraries/Firebase/examples/FirebasePush_ESP8266/FirebasePush_ESP8266.ino rename to examples/FirebasePush_ESP8266/FirebasePush_ESP8266.ino diff --git a/firebase/firebase.ino b/firebase/firebase.ino deleted file mode 100644 index 7bcddeb6..00000000 --- a/firebase/firebase.ino +++ /dev/null @@ -1,165 +0,0 @@ -// -// Copyright 2015 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#include -#include -#include - -const char* host = "burning-heat-7044.firebaseio.com"; -const int httpsPort = 443; -const char* fingerprint = "C1 56 CD D8 49 A3 7D D2 1D 49 60 7E 0D 59 A7 7C C1 0E 58 D2"; -struct Credential { - char token[148]; - char ssid[32]; - char password[32]; -} cred; -const int maxWifiConnectAttemps = 20; - -String buffer; - -void setup() { - Serial.begin(115200); - - EEPROM.begin(4096); - EEPROM.get(0, cred); - Serial.println(); - Serial.println("!I #!/dev/fail"); - Serial.print("!I token: "); - Serial.println(cred.token); - bool connected = false; - if (strlen(cred.ssid) > 0) { - connected = wifiConnect(); - } - if (!connected) { - Serial.println("!E no wifi connection"); - } -} - -bool wifiConnect() { - Serial.println("!I connecting to wifi"); - Serial.print("!I ssid: "); - Serial.println(cred.ssid); - Serial.print("!I "); - WiFi.begin(cred.ssid, cred.password); - for (int i = 0; i < maxWifiConnectAttemps; i++) { - delay(500); - Serial.print("."); - if (WiFi.status() == WL_CONNECTED) { - Serial.println(""); - Serial.println("!I wifi connected"); - Serial.print("!I ip: "); - Serial.println(WiFi.localIP()); - return true; - } - } - Serial.println(""); - Serial.println("!E wifi connection failed"); - return false; -} - -String buildRequest(String data) { - return data + "?auth=" + cred.token + " HTTP/1.1\r\n" + - "Host: " + host + "\r\n" + - "User-Agent: Chiplet\r\n" + - "Connection: close\r\n"; -} - -String unquote(String s) { - if (s[0] == '"' && s[s.length()-1] == '"') { - return s.substring(1, s.length()-1); - } - return s; -} - -void loop() { - String request; - - if (Serial.available() > 0) { - String data = Serial.readStringUntil('\n'); - data.trim(); - - if (data.startsWith("GET")) { - Serial.println(String("!I request: ") + data); - request = buildRequest(data) + "\r\n"; - } else if (data.startsWith("POST")) { - Serial.println(String("!I request: ") + data); - Serial.println("!I waiting for payload"); - buffer = buildRequest(data); - } else if (buffer.startsWith("POST")) { - // send POST request when complete - Serial.println(String("!I payload: ") + data); - Serial.println(String("!I content-length: ") + data.length()); - request = buffer + "Content-Length: " + data.length() + "\r\n\r\n" + data; - buffer = ""; - } else if (data.startsWith("TOKEN")) { - data.substring(6).toCharArray(cred.token, sizeof(cred.token)); - EEPROM.put(0, cred); - EEPROM.commit(); - Serial.println(String("!I token updated: ") + cred.token); - } else if (data.startsWith("AT+CWJAP=")) { - String ssidPwd = data.substring(9); - int i = ssidPwd.indexOf(","); - unquote(ssidPwd.substring(0, i)).toCharArray(cred.ssid, sizeof(cred.token)); - if (i != -1) { - unquote(ssidPwd.substring(i+1)).toCharArray(cred.password, sizeof(cred.password)); - } else { - cred.password[0] = '\0'; - } - Serial.println("!I ssid: " + String(cred.ssid)); - Serial.println("!I password: " + String(cred.password)); - if (wifiConnect()) { - EEPROM.put(0, cred); - EEPROM.commit(); - Serial.println("OK"); - } - } else { - Serial.println("!E usage:"); - Serial.println("!E GET /path"); - Serial.println("!E POST /path"); - Serial.println("!E payload"); - Serial.println("!E TOKEN token"); - Serial.println("!E AT+CWJAP=ssid,passwd"); - Serial.println("!E AT+CWSAP=ssid"); - } - } - - if (request.length() > 0) { - WiFiClientSecure client; - if (!client.connect(host, httpsPort)) { - Serial.println("!E connection failed"); - return; - } - if (!client.verify(fingerprint, host)) { - Serial.println("!E certificate doesn't match"); - return; - } - Serial.println("!I connected"); - client.print(request); - request.trim(); - request.replace("\r\n", "\r\n!> "); - Serial.println(String("!> ") + request); - Serial.println("!I headers"); - while (client.connected()) { - String data = client.readStringUntil('\n'); - Serial.println("!< " + data); - } - Serial.println("!I body"); - while(client.available() > 0) { - String data = client.readStringUntil('\n'); - Serial.println(data); - } - } -}