Greetings all,
I am storing sensors data to firebase which is working fine but I want to add the time with each value.
I did a lot of research and I tried using json and other methods but nothing is working .
I get the time printing in the serial monitor but when I try to store it in firebase some methods give error or no error but the time wont upload .
The following is one of the codes I have been trying but its missing the lines to store date in firebase since that is my question.
I am using arduino wifi rev2 .
`
#include <WiFiNINA.h>
#include <Firebase_Arduino_WiFiNINA.h>
#include <Firebase_Arduino_WiFiNINA_HTTPClient.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#define FIREBASE_HOST "............"
#define FIREBASE_AUTH "................."
#define WIFI_SSID "......."
#define WIFI_PASSWORD "......."
const long utcOffsetInSeconds = 14400;
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP,utcOffsetInSeconds);
FirebaseData firebaseData;
bool state = false;
double currentTimestamp ;
void setup()
{
Serial.begin(115200);
delay(100);
Serial.println();
Serial.print("Connecting to Wi-Fi");
int status = WL_IDLE_STATUS;
while (status != WL_CONNECTED)
{
status = WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print(".");
delay(300);
timeClient.begin();
}
Serial.println();
Serial.print("Connected with IP: ");
Serial.println(WiFi.localIP());
Serial.println();
//Provide the authentication data
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH, WIFI_SSID, WIFI_PASSWORD);
Firebase.reconnectWiFi(true);
}
void loop()
{
//---------------------------------
timeClient.update();
/Serial.print(timeClient.getHours());
/Serial.print(":");
/Serial.print(timeClient.getMinutes());
/Serial.print(":");
/Serial.println(timeClient.getSeconds());
/String TimeNow = timeClient.getFormattedTime();
/ Serial.println(TimeNow);
}`