Replies: 1 comment 2 replies
-
Please see the example for how to use library correctly. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
can some one help me about this issue,
the error line is :
'FB_RTDB FIREBASE_CLASS::RTDB' is private within this context
the error at line :
if (Firebase.RTDB.getString(%fbdo, "CoLed/L1")) {
My code:
`#include <Arduino.h>
#if defined(ESP32)
#include <WiFi.h>
#elif defined(ESP8266)
#include <ESP8266WiFi.h>
#endif
#include "Firebase.h"
#include "./core/Firebase_Client_Version.h"
#include "./FirebaseFS.h"
//Provide the token generation process info.
#include "addons/TokenHelper.h"
//Provide the RTDB payload printing info and other helper functions.
#include "addons/RTDBHelper.h"
// Insert your network credentials
#define WIFI_SSID "mcsaula3"
#define WIFI_PASSWORD "mcshome2000"
// Insert Firebase project API Key
#define API_KEY "AIzaSyCxfAaljSjaQDqk1fCigT3LuDxy3Q4m1G8"
// Insert RTDB URLefine the RTDB URL */
#define DATABASE_URL "https://coled-b95a4-default-rtdb.firebaseio.com/"
//Define Firebase Data object
FirebaseData fbdo;
FirebaseAuth auth;
FirebaseConfig config;
//some importent variables
String sValue, sValue2;
bool signupOK = false;
int led1 = 2; //PIN D4 NODEMCU ESP8266 AMICA
void setup() {
Serial.begin(115200);
pinMode(led1,OUTPUT);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("Connecting to Wi-Fi");
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(300);
}
Serial.println();
Serial.print("Connected with IP: ");
Serial.println(WiFi.localIP());
Serial.println();
/* Sign up */
if (Firebase.signUp(&config, &auth, "", "")) {
Serial.println("ok");
signupOK = true;
}
else {
Serial.printf("%s\n", config.signer.signupError.message.c_str());
}
/* Assign the callback function for the long running token generation task */
config.token_status_callback = tokenStatusCallback; //see addons/TokenHelper.h
Firebase.begin(&config, &auth);
Firebase.reconnectWiFi(true);
}
void loop() {
if (Firebase.ready() && signupOK ) {
if (Firebase.RTDB.getString(%fbdo, "CoLed/L1")) {
if (fbdo.dataType() == "string") {
sValue = fbdo.stringData();
int a = sValue.toInt();
Serial.println(a);
if (a == 1){
digitalWrite(led1,HIGH);
}else{
digitalWrite(led1,LOW);
}
}
}
else {
Serial.println(fbdo.errorReason());
}
}
}
`
Beta Was this translation helpful? Give feedback.
All reactions