Quick measures & watchdog timers
Posted: Mon Sep 10, 2012 4:24 pm
What is the best way to quickly toggle an input or output? I've run into this a couple times when I want to send a quick pulse signal to my autofeeder or record a timepoint value. I've been using something like this
because I don't want it to set_average but once an hour so I don't constantly keep rewriting over the memory location for an hour. When I set it to second()==0, it doesn't work. Maybe it is too fast and it misses it? I also did this for my autofeeder, but it seems to work.
I 'm trying to avoid the delay function. As I seem to have issues with the watchdog timer resetting the controller when a delay is used. Also, I have this problem with my custom menu screens. Is there a function to turn off the WDT under certain contexts, like a custom menu screen where nothing is happening, but you need time to read it before going back to normal operation and WDT?
Thanks,
JOn
Code: Select all
{
if (minute()==0 && second()<5)
{
if (now()%3600) set_average(0, hour());Code: Select all
//Autofeeder Mode
if ( InternalMemory.read(VacationEnable) == 1 ) // check for vacation mode
{
// Check if the current time is equal to the start time.
if (NumMins(hour(), minute()) == (NumMins(InternalMemory.read(VacationStartHr), InternalMemory.read(VacationStartMin))))
{
if (second() == 0)
{
Feed = 1; // Turn on feeder and feedmode
ReefAngel.FeedingModeStart();
}
}
else if ( InternalMemory.read(VacationEnable) == 2 ) // check for 2x feeder vacation mode
{
if (NumMins(hour(), minute()) == (NumMins(InternalMemory.read(VacationStart2ndHr), InternalMemory.read(VacationStart2ndMin))))
{
if (second() == 0)
{
Feed = 1; // Turn on feeder and feedmode
ReefAngel.FeedingModeStart();
}
}
else
{
Feed = 0;
}
}Thanks,
JOn