Problem with Electricity Consumption Meter Sketch (TinyTX)

Hi,

I am using this sketch to read LED infrared pulses on my electricity meter.
The sketchs is uploaded to a TinyTX (Attiny84A-PU) and sends current Watt consumption to my raspberry pi using RFM12Pi from the OpenEnergyMonitor Shop.

https://github.com/nathanchantrell/TinyTX/blob/master/TinyTX_LDR_Meter/T...

Everything works fine, but...

If I use a higher send interval (please see line 33) above 30 seconds, it stops sending!
Maybe a problem with the sketch? Can anyone help?

Best regards,

Christian

Robert Wall's picture

Re: Problem with Electricity Consumption Meter Sketch (TinyTX)

I see your problem. There is an error in the sketch (or an assumption that you will not want a delay greater the 32.767 s).

sendInterval is a signed integer, therefore 1000 * sendInterval overflows at 32767.
If you declare sendInterval as an unsigned long, or change "1000" to "1000L" the problem should go away (until you ask for a delay of a few weeks!).

You should inform Nathan Chantrell of the error.

pfeilc's picture

Re: Problem with Electricity Consumption Meter Sketch (TinyTX)

Hi Robert,

great - thank you very much!!! :-)

I will change my code and also inform Nathan Chantrell of the error.

Best regards,

Christian

Comment viewing options

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