LED AND FIREBASE WITHOUT DELAY

my english is broken i know :frowning:

can i make my light sensor still read the light while sending the data to firebase. cause my arduino can only do 1 job between sending the data or read the sensor. so i loss few data while sending it to firebase. my data is coming every 0.4 sec or less so dont have the free window to send the data to firebase.
btw my project is read light sensor from Electricity meter asian things.

We can’t see your code.

#include <ESP8266WiFi.h>
#include <FirebaseArduino.h>
#include <ArduinoJson.h>
#include “DS3231.h”
#include <Wire.h>

#define FIREBASE_HOST “kucinkproject.firebaseio.com
#define FIREBASE_AUTH “iDopVEzg3cpXzMHYjacT23X4rpLrTZfSn8Igu6xh”
#define WIFI_SSID “KUCINK”
#define WIFI_PASSWORD “kucinkmiaw”
#define FIVEMIN (1000UL * 60 * 5)

RTClib RTC;
int DS1307 = 0x68;
// Variables will change:
int count = 0;
int Status = 0;
int jam = 0;
int menit = 0;
unsigned long rolltime = millis() + FIVEMIN;

DS3231 rtc;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Wire.begin();
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);

}
void loop() {
// put your main code here, to run repeatedly:
int sensorValue = analogRead(A0);
const unsigned long fiveMinutes = 5 * 60 * 1000UL;
static unsigned long lastSampleTime = 0 - fiveMinutes; // initialize such that a reading is due the first time through loop()

unsigned long now = millis();
if (sensorValue != 1024 & Status == 1)
{
count = count + 1 ;
Firebase.setInt("/Led/Count", count);
Status = 0;
char buf1[20];
char buf2[40];
DateTime now = RTC.now();
menit = now.minute();
jam = now.hour();
sprintf(buf2, “%02d_%02d_%02d_%02d_%02d_%02d”, now.year(), now.month(), now.day(), now.hour(), now.minute(), now.second());
sprintf(buf1, “%02d/%02d/%02d”, now.day(), now.month(), now.year());
Serial.print(F(“Date/Time: “));String tbuf(buf2);
String kepala=”/History/”+tbuf+"/count";
String kepala2="/History/"+tbuf+"/tanggal";
String kepala3="/History/"+tbuf+"/jam";
String kepala4="/History/"+tbuf+"/menit";

if((long)(millis() - rolltime) >= 0)
{
Firebase.setString("/Led/tanggal", buf1);
Firebase.setInt("/Led/Count", count);
Firebase.setInt(kepala, count);
Firebase.setString(kepala2, buf1);
Firebase.setInt(kepala3, jam);
Firebase.setInt(kepala4, menit);
rolltime += FIVEMIN;
count=0;
// add code to take temperature reading here
}

//Firebase.pushString("/History/"+buf2+"/menit", menit);
//Firebase.pushString("/History/"+buf2+"/jam", jam);
Serial.print("menit : ");
Serial.println(menit);
Serial.print("jam : ");
Serial.println(jam);
Serial.println(buf1);
Serial.println(count);
Serial.println(sensorValue);
Serial.println(“sensor offline”);
}
if (sensorValue == 1024)
{

Status = 1;
Serial.println(“sensor online”);
}
delay(300);

}

The "REPORT TO MODERATOR" is NOT a reply option.

Bob.