Automatic reboot of RA after set amount of time

Do you have a question on how to do something.
Ask in here.
Post Reply
bencollinz
Posts: 140
Joined: Wed Mar 13, 2013 5:36 pm

Automatic reboot of RA after set amount of time

Post 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.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Automatic reboot of RA after set amount of time

Post 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.
Roberto.
bencollinz
Posts: 140
Joined: Wed Mar 13, 2013 5:36 pm

Re: Automatic reboot of RA after set amount of time

Post 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
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Automatic reboot of RA after set amount of time

Post 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);
Roberto.
bencollinz
Posts: 140
Joined: Wed Mar 13, 2013 5:36 pm

Re: Automatic reboot of RA after set amount of time

Post 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?
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Automatic reboot of RA after set amount of time

Post by rimai »

Try this:

Code: Select all

if (now() % 10800 == 0 ) while(1);
Roberto.
bencollinz
Posts: 140
Joined: Wed Mar 13, 2013 5:36 pm

Re: Automatic reboot of RA after set amount of time

Post 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);
    }
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Automatic reboot of RA after set amount of time

Post by rimai »

negative
Roberto.
Post Reply