Closed thedarhok77 closed 4 years ago
Please provide the error log if any or check if the Firebase connection has been properly established.
Firebase.set("LED_STATUS",0);
Firebase.setInt("/LED_STATUS",0);
Thank you all, I ended up doing a totally different code but I could solve it, thanks!
Can someone tell me what I did wrong besides being born? The goal is to turn on and off the LED that is integrated in my ESP8266, it works perfectly with the example of blinking, thanks a lot in advance...
include
include
include
include
include
include
include
include
define FIREBASE_HOST "prueba2-1df50.firebaseio.com "
define FIREBASE_AUTH "xTiqBi92rKrTV9GMpQzP4TbBXdxAA5Wn95Pb3vtt"
define WIFI_SSID "Movistar_22670279"
define WIFI_PASSWORD "0091107058940"
void setup() {
Serial.begin(9600);
// connect to wifi.
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("connecting");
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
Serial.println();
Serial.print("connected: ");
Serial.println(WiFi.localIP());
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
pinMode(LED_BUILTIN,OUTPUT);
Firebase.set("LED_STATUS",0);
}
int n = 0;
void loop() {
// set value
n=Firebase.getInt("LED_STATUS");
// handle error
if (n==1) {
Serial.print("LED is ON");
digitalWrite(LED_BUILTIN,HIGH);
Serial.println(Firebase.error());
return;
delay(100);
}
else{
Serial.print("LED is OFF");
digitalWrite(LED_BUILTIN,LOW);
}
}