firebase sent message to ESP32

nikosX
Posts: 1
Joined: Fri Jun 03, 2022 6:43 am

firebase sent message to ESP32

Postby nikosX » Fri Jun 03, 2022 7:04 am

I am new to firebase and ESP32. I successfully wrote a sketch sending data to a firebase real time database.
I wonder if i can make the oposite ie to sent data from firebase to the ESP32.
I recently came across with the following example where the ESP32 request the led state continiously in the main loop.
Is there any other way without continiously requesting the led state? Maybe with firebase functions to target the spesific ESP32 and sent a message?

void loop() {
led_state = Firebase.getString("LED State: ");
if (led_state == "ON") {
Serial.println("Led is ON");
digitalWrite(led_gpio, HIGH);
}
else if (led_state == "OFF")
{
Serial.println("Led is OFF");
digitalWrite(led_gpio, LOW);
}
else {
Serial.println("Wrong value entered! Only ON or OFF accepted");
}
}

Who is online

Users browsing this forum: No registered users and 81 guests