can't get emontx to report temp at 5 min interval

mounted up another low power emontx and set time between readings to 300000 so it should have an interval of 5 mins...

 

but the maximum i have seen is 45 secs

is there some max limit?

code atached

Robert Wall's picture

Re: can't get emontx to report temp at 5 min interval

const int time_between_readings= 300000;

Why don't you look up the documentation on what int means, then check the documentation on the delay function that uses that value?

boelle's picture

Re: can't get emontx to report temp at 5 min interval

the sample sket says it should be in ms and i just thought it would be the time between readings in ms

 

 

boelle's picture

Re: can't get emontx to report temp at 5 min interval

read the sample sketch again and as i understand it

const int time_between_readings

is used to tell it how long it should sleep on this line

Sleepy::loseSomeTime(time_between_readings);

Robert Wall's picture

Re: can't get emontx to report temp at 5 min interval

Forget what you are trying to do, your problem is with your very basic understanding of programming. Look up the documentation on what int means, as in "int time_between_readings"  What is an "int" in the Arduino?

boelle's picture

Re: can't get emontx to report temp at 5 min interval

so i tried with a long instead of int.. same result

Robert Wall's picture

Re: can't get emontx to report temp at 5 min interval

Have you looked at the documentation for Sleepy::loseSomeTime( ) ?

boelle's picture

Re: can't get emontx to report temp at 5 min interval

a few mods to my code was all there is to it

 

const long time_between_readings= 60000;
 

and

for (byte i = 0; i < 5; ++i)  Edited by mod - Paul

for (byte i = 0; i < 5; i++)
  Sleepy::loseSomeTime(time_between_readings);

 

 

change 5 to whatever you want in minutes between readings

 

the main thing with losesometime is that it only works up to 60 sec in 16 ms intervals

 

Robert Wall's picture

Re: can't get emontx to report temp at 5 min interval

Correct!  You must always check the documentation when you have an unexplained error like that.

Jay's picture

Re: can't get emontx to report temp at 5 min interval

Hello Boelle/Robert

I added for (byte i = 0; i < 5; ++i) to ensure that my emontx updated every 5 minutes. But for some reason it updates every 6 minutes instead!

I have checked through the code, but cannot see why it updates every 6 instead of 5.

The file is attached.

pb66's picture

Re: can't get emontx to report temp at 5 min interval

Try changing 

(byte i = 0; i < 5; ++i) 

to

(byte i = 0; i < 5; i++)

 

Jay's picture

Re: can't get emontx to report temp at 5 min interval

I'll try that, thanks.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.