Get count when relay is on or off
Get count when relay is on or off
Hello,
I'm wondering if there are some ways to count how many times relay is turned on or off in the arduino? For example: when we use temp probes in order to switch on/off heater: if temp less than 25 turn on heater and if more than 26 turn off heater. And if during the day temp drops 3 times and heater is turned on 3 times - so is it possible to calculate such thing and use somewhere else in the code?
I'm wondering if there are some ways to count how many times relay is turned on or off in the arduino? For example: when we use temp probes in order to switch on/off heater: if temp less than 25 turn on heater and if more than 26 turn off heater. And if during the day temp drops 3 times and heater is turned on 3 times - so is it possible to calculate such thing and use somewhere else in the code?
Re: Get count when relay is on or off
You can count for a day and store the data in a custom variable.
It would show up as custom variable.
It would show up as custom variable.
Roberto.
Re: Get count when relay is on or off
But how to write such code in order to have such count? If I put code in the loop section when temp is less 25 then add 1 to the count - the count grows each milisecondrimai wrote:You can count for a day and store the data in a custom variable.
It would show up as custom variable.
Re: Get count when relay is on or off
You need a variable to control that.
Code: Select all
static boolean control=false;
if (ReefAngel.Relay.IsOn(Port1) && control==false)
{
control=true;
ReefAngel.CustomVar[0]++;
}
if (ReefAngel.Relay.IsOff(Port1) && control==true)
{
control=false;
}
Roberto.
Re: Get count when relay is on or off
Thanks!
By the way is there any possibility to have more custom variables that could be seen in the app? Or at least have some of them as text (not as number)?
By the way is there any possibility to have more custom variables that could be seen in the app? Or at least have some of them as text (not as number)?
Re: Get count when relay is on or off
custom variables are visible in my android app.
Sent from my XT1585 using Tapatalk
Sent from my XT1585 using Tapatalk
Re: Get count when relay is on or off
I'm getting compile errorrimai wrote:You need a variable to control that.Code: Select all
static boolean control=false; if (ReefAngel.Relay.IsOn(Port1) && control==false) { control=true; ReefAngel.CustomVar[0]++; } if (ReefAngel.Relay.IsOff(Port1) && control==true) { control=false; }
error: 'class RelayClass' has no member named 'IsOn'
error: 'class RelayClass' has no member named 'IsOff'
Re: Get count when relay is on or off
Only 7 are available and all of them are number which cannot exceed ~300binder wrote:custom variables are visible in my android app.
Sent from my XT1585 using Tapatalk
I would like to have more variables shown on android app or have them as text (as I'm trying to display some information for reporting failures in my reef)
Re: Get count when relay is on or off
Sorry. Try this:
Code: Select all
static boolean control=false;
if (ReefAngel.Relay.Status(Port1)==true && control==false)
{
control=true;
ReefAngel.CustomVar[0]++;
}
if (ReefAngel.Relay.Status(Port1)==false && control==true)
{
control=false;
}
Roberto.
Re: Get count when relay is on or off
Ahhhh... gotcha. the libraries would have to be modified to allow for larger values or to display text instead.Armetas wrote:Only 7 are available and all of them are number which cannot exceed ~300binder wrote:custom variables are visible in my android app.
Sent from my XT1585 using Tapatalk
I would like to have more variables shown on android app or have them as text (as I'm trying to display some information for reporting failures in my reef)
most likely it would have to be additional custom variables added instead of the same ones...or maybe not (at least for getting larger values). the text would require separate variables.
Sent from my XT1585 using Tapatalk
Re: Get count when relay is on or off
Thank you. It works perfectlyrimai wrote:Sorry. Try this:Code: Select all
static boolean control=false; if (ReefAngel.Relay.Status(Port1)==true && control==false) { control=true; ReefAngel.CustomVar[0]++; } if (ReefAngel.Relay.Status(Port1)==false && control==true) { control=false; }
Re: Get count when relay is on or off
Is there a way who could change the libraries for such purpose. And how about android app? Will it handle longer variables? Or even text?binder wrote:Ahhhh... gotcha. the libraries would have to be modified to allow for larger values or to display text instead.Armetas wrote:Only 7 are available and all of them are number which cannot exceed ~300binder wrote:custom variables are visible in my android app.
Sent from my XT1585 using Tapatalk
I would like to have more variables shown on android app or have them as text (as I'm trying to display some information for reporting failures in my reef)
most likely it would have to be additional custom variables added instead of the same ones...or maybe not (at least for getting larger values). the text would require separate variables.
Sent from my XT1585 using Tapatalk
Get count when relay is on or off
yes, it is possible to change the libraries around to do this. what i would suggest is creating a separate discussion topic/thread that we can discuss it in more detail of what you are wanting to accomplish. then we can create a testing branch for the libraries to test out functionality. if all goes well, then the changes could get merged into the main branch of the libraries.Armetas wrote:
Is there a way who could change the libraries for such purpose. And how about android app? Will it handle longer variables? Or even text?
then i could find some time to create a special build of my android app to help test and display the variables.
so that’s how i would suggest handling this so there’s a clear, open discussion on what is desired and we can move forward from there.
Sent from my iPad using Tapatalk
Re: Get count when relay is on or off
Why don't you just use alert emails for that?
You can type anything on email alerts.
You can type anything on email alerts.
Roberto.
Re: Get count when relay is on or off
and yes, roberto’s idea would be the simplest and easiest to do.
one issue with sending text is the size. the more text on the controller, the bigger the code and harder it is to maintain. you are also limited with the options and changing them is harder. the email alerts are changed much easier without modifying the libraries.
Sent from my iPad using Tapatalk
one issue with sending text is the size. the more text on the controller, the bigger the code and harder it is to maintain. you are also limited with the options and changing them is harder. the email alerts are changed much easier without modifying the libraries.
Sent from my iPad using Tapatalk
Re: Get count when relay is on or off
But email alerts are outside the controller. Im writing code in the arduino ir order to track some things to catch when there is a problem and even now my all custom variables are fully occupied, im even saving like 31, 32, 120 values which represent for example: 32 - water in issue when changing water on 3rd time. I hope that you get what im trying to achieverimai wrote:Why don't you just use alert emails for that?
You can type anything on email alerts.