problem with update "frequency" to thingspeak site

hi guys

I used a code for updating values from 4 sensors to thingspeak website every 15 sec and it works smoothly
but when I move this code to my project's code the frequency of update would vary time to time sometimes every 15 sec as it should but somethings it takes 3 min or 2 min to update

I put some {} and (got rid of some delays )to separate my code from thingspeak code and I got better result but still, the problem exists

and when I change the interval from 15 sec to 1 min, I get no date in thingspeak ( i didn't wait too long to see if it shows me anything in long run )

I attached these two code, what am I missing here?

try27.ino (11.2 KB)

sending_4_sensor_data_to_thingspeak.ino (5.72 KB)

What exactly are the two programs attached ?
Does one work and one not ?

the smaller one is only the program that sends data to thingspeak and it works

the bigger one is when I intergrade the working program into a bigger project and it works but the interval between date send varies time to time

One potential source of delay I see is the lightMeter.readLightLevel() calls. Those calls have delays and you call that twice in loop(). You might want to comment those out and see if your timing is consistent again.