I'm counting the pulse from my power meter.
1 pluse = 1Wh
During the day, arduino count the pulse and pass the value to HS device (SendToHS).
If for some reason I restart arduino, the pulse counter restart from zero.
I could store the value in the eprom but a lot of write on eprom will cause the eprom fail.
So, in variables declaration I added
and in the loop
pulse_counter is declared as integer.
Is possible to pass to arduino (FromHS) an integer or this function is limited to a byte?
EDIT: SOLVED! Yes, i possible to pass an integer.
I added the code in a statement "if (IsConnected == true) {
/*Execute ONLY when HomeSeer is connected*/"
Now works fine.
1 pluse = 1Wh
During the day, arduino count the pulse and pass the value to HS device (SendToHS).
If for some reason I restart arduino, the pulse counter restart from zero.
I could store the value in the eprom but a lot of write on eprom will cause the eprom fail.
So, in variables declaration I added
Code:
boolean arduino_restarted = 1;
Code:
if (arduino_restarted > 0) { pulse_counter = FromHS[1]; arduino_restarted = 0; } /// after the code to read the pulse (getpulsein) // and arduino_restarted = arduino_restarted +1
Is possible to pass to arduino (FromHS) an integer or this function is limited to a byte?
EDIT: SOLVED! Yes, i possible to pass an integer.
I added the code in a statement "if (IsConnected == true) {
/*Execute ONLY when HomeSeer is connected*/"
Now works fine.