SHARE
TWEET

Untitled

a guest Aug 19th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //#include <SimpleDHT.h>
  2. #include <ESP8266WiFi.h>
  3. #include <FirebaseArduino.h>
  4.  
  5. // Config Firebase
  6. #define FIREBASE_HOST "kanjamefinal1.firebaseio.com"
  7. #define FIREBASE_AUTH "2qQkrN1Obwza1GiKaZwId8TFk749DeMV06PGHgU8"
  8.  
  9. // Config connect WiFi
  10. #define WIFI_SSID "firstwifija"
  11. #define WIFI_PASSWORD "0979244702"
  12.  
  13. int i = 0;
  14.  
  15. void setup() {
  16.   Initialization();
  17.   WiFiConnection();
  18. }
  19. int counter = 0;
  20. void loop() {
  21.  Firebase.setInt("counter", counter++);
  22.  Serial.println(counter);
  23.  String path = "/";
  24.  FirebaseObject object = Firebase.get(path);
  25.  int counters = object.getInt("counter");
  26.  Serial.println(1000-counters);
  27.  delay(2000);
  28. }
  29.  
  30. void Initialization()
  31. {
  32.   Serial.begin(115200);
  33. //  pirMode(LED_BUILTIN, OUTPUT);
  34. }
  35. void WiFiConnection()
  36. {
  37.   WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  38.   Serial.print("connecting");
  39.   while(WiFi.status() != WL_CONNECTED)
  40.   {
  41.     Serial.print(".");
  42.     delay(500);
  43.   }
  44.   Serial.println();
  45.   Serial.print("connected: ");
  46.   Serial.println(WiFi.localIP());
  47.  
  48.   Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
  49. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top