Hello,
I am using the ATO switch as flood protection for external equipment. In theory, When there is a leak it will fill up tank that is holding equipment. When the level switch is made (float on bottom/wire on top) it shuts off the outlet. However, the way this code is wrote after 60 seconds it times out and it shuts off the outlet when there is no leak. Can I get rid of the timeout
Doesn't sound like you wan tto use the SingleATO command. That will turn on the port when the switch is not active and shut it off when the timeout runs out or if the float switch floats up to connect the circuit.
With that if the switch is normal, the port should be on, if the switch is active, the port will be off. If it doesn't work as expected, take out the !
Hello,
Thanks for the reply!
Ok, so I tried with the (!) but it didn't work. So I removed the (!) and it works for the switch but the buzzer keeps buzzing.
Question for you?? When the you get the red or green light for ATO does green mean you have a high ATO or does it mean you don't have a high ATO? When you lift the float switch it goes green.
So what does the (!) do and why did you have it in there? Trying to learn this type of code. Thanks again!
Change >= to == 1. If it still doesnt do what you expect change it to !=
The ! Means NOT. The reason its always buzzing is because your test is greater than or equal to 1 or less than or equal to 1.
Since the atohighflag will be 0 or 1 we can just use an == or != test. Once we know the state you COULD change it to use < or > but i dont think you should use >= or <=. Does that make sense?
Ok reason < 0 didn't work is because you aren't getting a negative number so it can't be less than 0... the above should take care of it. Plus I have an error in the code i gave you because highfloatflag is being set AFTER we set the port..
Basically we're using highfloatflag as a boolean and you can change it's declaration from byte to boolean if you like. So the new code says if highfloatflag is true which means the float switch is active we shut off the port and turn on the buzzer and if it's false it will keep the port on and buzzer will be 0. I'm pretty sure this will do the trick at this point.
Hello,
First I want to thank you for sticking through this with me. Well I swapped around the lines and changed the highfloatflag. So the outlet is correct when it goes high it does shut off but the buzzer goes to 100% when the switch is low and goes to 0% on High. Not to sure what's the deal.
#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <Humidity.h>
#include <DCPump.h>
#include <ReefAngel.h>
// Initialize Buzzer variables
byte buzzer=0;
byte highfloatflag=0;
////// Place global variable code below here
////// Place global variable code above here
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
ReefAngel.Use2014Screen(); // Let's use 2014 Screen
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = 0;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port2Bit | Port3Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = 0;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 830 );
// Ports that are always on
ReefAngel.Relay.On( Port3 );
ReefAngel.Relay.On( Port4 );
ReefAngel.Relay.On( Port5 );
ReefAngel.Relay.On( Port6 );
ReefAngel.Relay.On( Port7 );
ReefAngel.Relay.On( Port8 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.CO2Control( Port1,638,678 );
highfloatflag = ReefAngel.HighATO.IsActive();
ReefAngel.Relay.Set(Port2, highfloatflag);
if (highfloatflag) buzzer = 100; else buzzer=0;
ReefAngel.PWM.SetDaylight( buzzer );
////// Place your custom code below here
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "westonhull" );
ReefAngel.ShowInterface();
}
I tried the != 1 and that was 100% on high and 1% on low.
I thought I tried the == but I guess, I didn't write that one down on my pad. I'll let you know in a sec.
Hello,
Well that worked! You are way better at this than I am. Where did you learn this language from? Do you have any books for dummy's for this stuff, if so I need them to get them? Anyways, Here is the final code. Thanks for helping me!
The language is C. You can find many books and sites on the language. It's pretty straight forward. The challenge here I think was just the different approach that was taken with the comparison and a bit of brain fart on my end.