Page 1 of 1

Automatic reboot of RA after set amount of time

Posted: Wed Jan 07, 2015 7:35 pm
by bencollinz
You can reboot from the Android app, so how would I put that into the code to happen after a certain amount of time presumably after the last reboot or power on?

Thank you.

Re: Automatic reboot of RA after set amount of time

Posted: Thu Jan 08, 2015 9:34 am
by rimai
All you need to force a reboot is this line:

Code: Select all

while(1);
It will force the watchdog to reboot the controller.

Re: Automatic reboot of RA after set amount of time

Posted: Thu Jan 08, 2015 5:47 pm
by bencollinz
rimai wrote:All you need to force a reboot is this line:

Code: Select all

while(1);
It will force the watchdog to reboot the controller.
please, can you tell me where I put this in the code? and does it reboot randomly then? or a certain amount of time?
i'm arduino illiterate.

thank you

Re: Automatic reboot of RA after set amount of time

Posted: Thu Jan 08, 2015 5:51 pm
by rimai
No, the minute this is executed, it will reboot right away.
To force a reboot at a specific time, all you need is this:

Code: Select all

if (hour()==10 && minute()==0 && second()==0) while(1);

Re: Automatic reboot of RA after set amount of time

Posted: Mon Jan 26, 2015 2:18 pm
by bencollinz
ok. is there an easier way to say to reboot every 3 hours? or I have to put in 8 of those lines of code?

Re: Automatic reboot of RA after set amount of time

Posted: Mon Jan 26, 2015 2:21 pm
by rimai
Try this:

Code: Select all

if (now() % 10800 == 0 ) while(1);

Re: Automatic reboot of RA after set amount of time

Posted: Mon Jan 26, 2015 2:57 pm
by bencollinz
rimai wrote:Try this:

Code: Select all

if (now() % 10800 == 0 ) while(1);
thank you.
would this conflict?

Code: Select all

if (now()-feeding<5400) {
  ReefAngel.RF.UseMemory=false;
    ReefAngel.RF.SetMode(Smart_NTM,75,10);
    }

Re: Automatic reboot of RA after set amount of time

Posted: Mon Jan 26, 2015 3:40 pm
by rimai
negative