highlight.js

星期一, 8月 06, 2018

firebase-arduino 程式庫無法更新資料

如果您有使用 firebase-arduino 程式庫由 ESP8266 控制板上傳資料到 Firebase 的資料庫, 會發現從約莫上週五開始, 就會失敗, 這是因為 Firebase 更新了他們的數位指紋 (fingerprint), 為此 firebase-arduino 也在幾天前修改了程式庫內容 (可參考這一篇文章)。您可以重新下載程式庫, 安裝到 Arduino 開發環境中就可以解決, 或者也可以直接修改 FirebaseHttpClient.h 檔, 將 kFirebaseFingerprint 字串的內容修改為 "6F D0 9A 52 C0 E9 E4 CD A0 D3 02 A4 B7 A1 92 38 2D CA 2F 26" , 再重新編譯程式執行即可。

8 則留言:

Unknown 提到...

執行後出現這樣的錯誤,可以幫忙我嗎,已經試過很多地方了 還是不行
謝謝~

In file included from D:\2.ALL WORK\arduino\arduino\DATA_MCU\DATA_MCU.ino:1:0:

C:\Users\USER\Documents\Arduino\libraries\firebase-arduino-master\src/Firebase.h:26:25: fatal error: ArduinoJson.h: No such file or directory

#include
^
compilation terminated.

exit status 1
開發板 NodeMCU 1.0 (ESP-12E Module) 編譯錯誤。

meebox 提到...

看起來是你少了 ArduinoJson 程式庫, 請在這裡下載:

ArduinoJson

下載後從『草稿碼/匯入程式庫/加入.zip 程式庫』將此程式庫匯入 Arduino 開發環境, 再重新編譯應該就可以了。

Unknown 提到...

謝謝~~可以用了 編譯過了

匿名 提到...

我加入函示庫以後執行會出現錯誤,可以請你幫忙一下嗎,找過很多地方了,一直沒有答案,麻煩了
In file included from C:\Users\nikon\Documents\Arduino\libraries\firebase-arduino-master\src/Firebase.h:30,

from C:\Users\nikon\Desktop\TEST1\TEST1.ino:2:
C:\Users\nikon\Documents\Arduino\libraries\firebase-arduino-master\src/FirebaseObject.h:109:11: error: StaticJsonBuffer is a class from ArduinoJson 5. Please see https://arduinojson.org/upgrade to learn how to upgrade your program to ArduinoJson version 6
109 | std::shared_ptr> buffer_;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:\Users\nikon\Desktop\TEST1\TEST1.ino:2:
C:\Users\nikon\Documents\Arduino\libraries\firebase-arduino-master\src/Firebase.h:86:11: error: StaticJsonBuffer is a class from ArduinoJson 5. Please see https://arduinojson.org/upgrade to learn how to upgrade your program to ArduinoJson version 6
86 | std::shared_ptr> buffer_;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
exit status 1
開發板 NodeMCU 1.0 (ESP-12E Module) 編譯錯誤。

meebox 提到...

這是因為 firebase-arduino 已經停止更新了, 他需要使用 5.x 版的 ArduinoJson 程式庫, 但是 ArduinoJson 最新版本已經是 6.x, 你的 Arduino IDE 上安裝的應該就是 6.x 版的 ArduinoJson, 只要用『管理程式庫』選用 5.x 版的 ArduinoJson 就可以了。

Unknown 提到...


In file included from C:\Users\dunca\OneDrive\���\Arduino\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:9:
C:\Users\dunca\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:166:10: note: candidate: 'bool HTTPClient::begin(String, uint16_t, String)' (near match)
166 | bool begin(String host, uint16_t port, String uri = "/") __attribute__ ((error("obsolete API, use ::begin(WiFiClient, host, port, uri)")));
| ^~~~~
C:\Users\dunca\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:166:10: note: conversion of argument 2 would be ill-formed:
C:\Users\dunca\OneDrive\���\Arduino\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:47:30: error: invalid conversion from 'const char*' to 'uint16_t' {aka 'short unsigned int'} [-fpermissive]
47 | http_.begin(url.c_str(), kFirebaseFingerprint);
| ^~~~~~~~~~~~~~~~~~~~
| |
| const char*
In file included from C:\Users\dunca\OneDrive\���\Arduino\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:9:
C:\Users\dunca\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:167:10: note: candidate: 'bool HTTPClient::begin(String, const uint8_t*)' (near match)
167 | bool begin(String url, const uint8_t httpsFingerprint[20]) __attribute__ ((error("obsolete API, use ::begin(WiFiClientSecure, ...)")));
| ^~~~~
C:\Users\dunca\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:167:10: note: conversion of argument 2 would be ill-formed:
C:\Users\dunca\OneDrive\���\Arduino\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:47:30: error: invalid conversion from 'const char*' to 'const uint8_t*' {aka 'const unsigned char*'} [-fpermissive]
47 | http_.begin(url.c_str(), kFirebaseFingerprint);
| ^~~~~~~~~~~~~~~~~~~~
| |
| const char*
C:\Users\dunca\OneDrive\���\Arduino\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp: In member function 'virtual void FirebaseHttpClientEsp8266::begin(const string&, const string&)':
C:\Users\dunca\OneDrive\���\Arduino\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:51:60: error: invalid conversion from 'const char*' to 'const uint8_t*' {aka 'const unsigned char*'} [-fpermissive]
51 | http_.begin(host.c_str(), kFirebasePort, path.c_str(), kFirebaseFingerprint);
| ^~~~~~~~~~~~~~~~~~~~
| |
| const char*
In file included from C:\Users\dunca\OneDrive\���\Arduino\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:9:
C:\Users\dunca\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:168:70: note: initializing argument 4 of 'bool HTTPClient::begin(String, uint16_t, String, const uint8_t*)'
168 | bool begin(String host, uint16_t port, String uri, const uint8_t httpsFingerprint[20]) __attribute__ ((error("obsolete API, use ::begin(WiFiClientSecure, ...)")));
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
exit status 1
開發板 NodeMCU 1.0 (ESP-12E Module) 編譯錯誤。

Unknown 提到...

不好意思可以麻煩幫我看一下我是哪裡出錯了嗎 試了很多種方法都沒辦法解決

meebox 提到...

沒有程式檔案別人很難檢查是什麼問題, 請附上你的程式檔, 謝謝