บทความ

กำลังแสดงโพสต์จาก กุมภาพันธ์, 2021

csv to firebase

 bool log_to_fb(){   String log_buf="";     if((Firebase.getString(firebaseData, on_path+"/lc"))){   String buf =  firebaseData.stringData();   fb_count = buf.toInt();     if ((log_count<= fb_count)){ return(false);}       if ((SPIFFS.exists("/log.csv"))){     File f = SPIFFS.open("/log.csv", "r");     if (!f){return(false);}         while(f.available()) {               log_buf = "";               log_buf = f.readStringUntil('\n');               log_buf +="\0";                 splitCommand(log_buf);                  }               f.close();               return(true);         }      }else{return(true);}          } //===================================================================================== bool splitCommand(String text) { String dt="",rh="",rt="",ft="",ct="",bt="",pw="",nw="",lc=""; int index =0; bool FB

Async IOT

 #include <stdio.h> #include <ESPAsync_WiFiManager.h> AsyncWebServer   server(80); DNSServer        dnsServer; #define host       "TMR01" String  station =  "TMR01"; #define OK         Serial.println("ok"); #define NOT_OK     Serial.println("Not ok"); #define MEM_INFO   MyMemInfo(); /*#include <FirebaseESP8266.h> #define tmr_debug  false #define FIREBASE_HOST "wt-.firebaseio.com" #define FIREBASE_AUTH "JpQKm0dK7vMYc86gaJKDQyquDMEPgPNQti8lAAA" FirebaseData fbdo; FirebaseJson json;*/ unsigned long stTime; unsigned long useTime; unsigned long total_mem; unsigned long total_use; FSInfo        fs_info; int           Year=21,Month=2,Day=9,Hour=0,Minute =0; float         Rh=0.00, Rt=0.00, Tp1=0.00, Tp2=0.00; String        fname, sTm, sRh,sRt,sT1,sT2; char          buf[200]; void MyMemInfo(){ //-----------------------------   useTime=millis()-stTime;   Serial.print ("Format time = ");   Serial.print(useTime
 #include <stdio.h> #include <WiFi.h> #include <FirebaseESP32.h> #define WIFI_SSID "WIFI_AP" #define WIFI_PASSWORD "WIFI_PASSWORD" #define FIREBASE_HOST "PROJECT_ID.firebaseio.com" #define FIREBASE_AUTH "DATABASE_SECRET" FirebaseData fbdo; FirebaseJson json; float Rh= 30.30; float Rt= 31.30; float Tp1=32.30; float Tp2=33.30; char buf[64]; void setup() {   Serial.begin(115200);   WiFi.begin(WIFI_SSID, WIFI_PASSWORD);   Serial.print("Connecting to Wi-Fi");   while (WiFi.status() != WL_CONNECTED)   {     Serial.print(".");     delay(300);   }   Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);   Firebase.reconnectWiFi(true);   Firebase.setReadTimeout(fbdo, 1000 * 60);   Firebase.setwriteSizeLimit(fbdo, "tiny");   Firebase.setFloatDigits(2);   Firebase.setDoubleDigits(6); String   path = "/TEST/Rh";     Firebase.setFloat(fbdo, path,Rh);      path = "/TEST/Rt";   Firebase.setFloat(fbdo, p

Firebase Google Chart

<html>   <head>    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>    <script src="https://www.gstatic.com/firebasejs/3.7.4/firebase.js"></script>    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>    <script src="https://www.google.com/jsapi"></script> <script type="text/javascript"> //===============================================================================================================   var firebaseConfig = {         apiKey: "AIzaSyDzsxMsTq4gkuI2in",         authDomain: "wt-vstr4.firebaseapp.com",         databaseURL: "https://wt-vstr4.firebaseio.com",         projectId: "wt-vstr4&qu