I really need help.... #662
Unanswered
SkullGamer5
asked this question in
Q&A
Replies: 2 comments 1 reply
-
Sign up as anonymous creates a new junk user in your project every time you sign up. If you use it carelessly, the number of anonymous users in your project can be over the limit (100 million anonymous users). Even this is not the cause of your issue, but you should sign in with normal email and password instead. Any way I recommend you use this new FirebaseClient library instead. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Update that you wan to note
Code#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <Firebase_ESP_Client.h>
#include "addons/TokenHelper.h"
#include "addons/RTDBHelper.h"
// Wi-Fi credentials
#define WIFI_SSID "loop" // Replace with your Wi-Fi SSID
#define WIFI_PASSWORD "cyber@123" // Replace with your Wi-Fi password
// Firebase credentials
#define API_KEY "xyz"
#define DATABASE_URL "https://project_name-default-rtdb.asia-southeast1.firebasedatabase.app"
#define USER_EMAIL "[email protected]"
#define USER_PASSWORD "1234567890"
FirebaseData fbdo;
FirebaseAuth auth;
FirebaseConfig config;
void setup() {
Serial.begin(115200);
// Connect to Wi-Fi
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("Connecting to Wi-Fi");
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
Serial.println("\nConnected to Wi-Fi");
// Firebase configuration
Serial.printf("Firebase Client v%s\n\n", FIREBASE_CLIENT_VERSION);
config.api_key = API_KEY; // Set API key
config.database_url = DATABASE_URL; // Set Database URL
auth.user.email = USER_EMAIL; // Set user email
auth.user.password = USER_PASSWORD; // Set user password
config.token_status_callback = tokenStatusCallback; // Set token status callback
fbdo.setBSSLBufferSize(2048, 1024);
Firebase.begin(&config, &auth);
Firebase.reconnectWiFi(true);
}
void loop() {
if (Firebase.ready()) {
if (Firebase.RTDB.getBool(&fbdo, "/Relays/R1")) {
if (fbdo.dataType() == "boolean") {
bool relayStatus = fbdo.boolData();
Serial.println("Relay Status: " + String(relayStatus));
} else {
Serial.println("Data type is not boolean.");
}
} else {
Serial.println("Failed to read from Firebase: " + fbdo.errorReason());
}
}
delay(5000); // Delay before the next read
} Output |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi. so I wanted to turn On/Off a relay for an IOT project but i tried everything and nothing works.
I set the RTDB's rules like this:
so there is no securaity at all.
i am using ESP8266/nodemcu 1.0 and here is my code:
but i get the error:
token is not ready (revoked or expired)
I really need help and thank you for your great library.
Beta Was this translation helpful? Give feedback.
All reactions