-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFirebase.ino
More file actions
44 lines (31 loc) · 1.11 KB
/
Copy pathFirebase.ino
File metadata and controls
44 lines (31 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
ram#include <FirebaseArduino.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <ESP8266WiFi.h>
WiFiUDP udp;//Cria um objeto "UDP".
NTPClient ntp(udp, "a.st1.ntp.br", -3 * 3600, 60000);//Cria um objeto "NTP" com as configurações.
#define FIREBASE_HOST "imunode-eb93f.firebaseio.com"
#define WIFI_SSID "Nome da rede aqui " // Change the name of your WIFI
#define WIFI_PASSWORD "senhaaqui" // Change the password of your WIFI
String hora;//Váriavel que armazenara o horario do NTP;
void setup() {
Serial.begin(115200);
WiFi.begin (WIFI_SSID, WIFI_PASSWORD);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print("Start1");
}
Serial.println ("Start");
Serial.println ("WiFi Connected!");
Firebase.begin(FIREBASE_HOST);
ntp.begin();//Inicia o NTP.
ntp.forceUpdate();//Força o Update.
}
void loop() {
hora = ntp.getFormattedTime();//Armazena na váriavel HORA, o horario atual.
Serial.println(hora);//Printa a hora já formatada no monitor.
Firebase.pushString ("Hora",hora);
//Firebase.pushFloat ("Humidity",h);
delay(1000);
delay(200);
}