Closed jamsyogendra closed 3 months ago
Read the library documentation thoroughly for the concepts and proper usage.
can you tell me whats wrong in my code and can you make changes for me please
On Sun, Aug 18, 2024 at 8:54 PM Suwatchai K. @.***> wrote:
Read the library documentation thoroughly for the concepts and proper usage.
— Reply to this email directly, view it on GitHub https://github.com/mobizt/FirebaseClient/issues/133#issuecomment-2295300256, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALXAOEIWGXM4MLAC6FF2T33ZSC4ETAVCNFSM6AAAAABMWOM45WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJVGMYDAMRVGY . You are receiving this because you authored the thread.Message ID: @.***>
Read and follow the examples comments.
// Define the relay pin
WiFiClientSecure ssl; DefaultNetwork network; AsyncClientClass client(ssl, getNetwork(network));
FirebaseApp app; RealtimeDatabase Database; AsyncResult result; LegacyToken dbSecret(DATABASE_SECRET);
void printError(int code, const String &msg) { Serial.printf("Error, msg: %s, code: %d\n", msg.c_str(), code); }
void setup() { Serial.begin(115200); pinMode(RELAY_PIN, OUTPUT); digitalWrite(RELAY_PIN, LOW); // Ensure relay is off initially
// Connect to Wi-Fi
Serial.print("Connecting to Wi-Fi");
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
while (WiFi.status() != WL_CONNECTED)
{
Serial.print(".");
delay(300);
}
Serial.println();
Serial.print("Connected with IP: ");
Serial.println(WiFi.localIP());
Serial.println();
// Initialize Firebase
Serial.println("Initializing Firebase...");
Firebase.printf("Firebase Client v%s\n", FIREBASE_CLIENT_VERSION);
ssl.setInsecure();
ssl.setBufferSizes(1024, 1024);
// Initialize the authentication handler.
initializeApp(client, app, getAuth(dbSecret));
// Binding the authentication handler with your Database class object.
app.getApp<RealtimeDatabase>(Database);
// Set your database URL
Database.url(DATABASE_URL);
// In sync functions, we have to set the operating result for the
client that works with the function. client.setAsyncResult(result);
// Control the relay based on the Firebase value
controlRelay();
}
void controlRelay()
{
// Read the relay state from Firebase
Serial.print("Fetching relay state from Firebase... ");
if (Database.get
// Control the relay based on the Firebase value
digitalWrite(RELAY_PIN, relayState ? HIGH : LOW);
}
else
{
printError(client.lastError().code(), client.lastError().message());
}
}
void loop() { // Fetch and update relay state every 10 seconds controlRelay(); delay(10000); // Wait 10 seconds before the next read } // again this code written by me i am using esp8266 latest board version with arduino json 6.21.2 and latest version of your lib , getting data from database but again relay not going to change his state i also change the firebase rule as true
On Sun, Aug 18, 2024 at 9:33 PM Suwatchai K. @.***> wrote:
Read and follow the examples comments.
— Reply to this email directly, view it on GitHub https://github.com/mobizt/FirebaseClient/issues/133#issuecomment-2295310991, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALXAOENGS52KMP23V53MMZ3ZSDATXAVCNFSM6AAAAABMWOM45WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJVGMYTAOJZGE . You are receiving this because you authored the thread.Message ID: @.***>
You didn't even try to read the documentation.
I never give user advice and never wrote the examples and documentation about using delay in all my Firebase libraries in almost 6 years of development.
Sorry 😐 i apologize for it from bottom of my heart, I read it then get back to you, I hope will always here for my help
On Sun, Aug 18, 2024, 9:40 PM Suwatchai K. @.***> wrote:
You don't even try to read the documentation.
— Reply to this email directly, view it on GitHub https://github.com/mobizt/FirebaseClient/issues/133#issuecomment-2295313361, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALXAOENMNTUPBTGN66VV2FDZSDBPTAVCNFSM6AAAAABMWOM45WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJVGMYTGMZWGE . You are receiving this because you authored the thread.Message ID: @.***>
no any error in showing in my serial monitor but my code stacked ,
i am geeting realtime data or changes in data from my app but my relay not going to change state
can anyone solve or any suggestions.