#include ESP8266WiFi.h; //https://github.com/esp8266/Arduino
//needed for library
#include FirebaseArduino.h;
 
#define FIREBASE_HOST "kio4.firebaseio.com"
//This is your Firebase Hostname which can be found in the Firebase console.
#define FIREBASE_AUTH "AIzaSyADcunxlQRp9wgnIlZZObCcVDFuwfQ-fEk"
//This is the database secret(legacy), not firebase service or web key.
#define WIFI_SSID "ONOA4E5"
//SSID of your ruter.
#define WIFI_PASSWORD "1442552253"
 
int ledPin = 0;
//int data=1;
 
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
// Serial.print("connecting");
 
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
 
//if you get here you have connected to the WiFi
// Serial.println("connected...yeey :)");
 
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
//Firebase.set("redlight", 0);
 
pinMode(LED_BUILTIN, OUTPUT); digitalWrite(LED_BUILTIN, HIGH);
 
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(LED_BUILTIN, Firebase.getInt("redlight"));
Serial.println(Firebase.getInt("redlight"));
 
if (Firebase.failed()) {
Serial.println(Firebase.error());
}
 
delay(500);
 
}