straight forward float valve control

Request new hardware or ideas for the controller
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: straight forward float valve control

Post by rimai »

Curt is working on adding some other stuff to the libraries.
Once he does, all you need to do to update your libraries is use the update utility: http://www.reefangel.com/update
Then upload the same code with the new updates.
Roberto.
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: straight forward float valve control

Post by rossbryant1956 »

Thanks. I pulled 0.9.3 the other nite, are we talking newer updates?

Does that boy ever rest? Thx Curt.
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: straight forward float valve control

Post by binder »

rossbryant1956 wrote:Thanks. I pulled 0.9.3 the other nite, are we talking newer updates?

Does that boy ever rest? Thx Curt.
Yes, there's a group of things being added to a 0.9.4 release. It's not done just yet. There's a few more things that need to be confirmed before a release.

I do rest sometimes. ;) I need to rest more though. Welcome!
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: straight forward float valve control

Post by rossbryant1956 »

I never really did figure out the problems I was having with these routines, just ripped out the code and the hardware until I could get back to it. So now I am going to try again and I'd like some collective wisdom.

I intend to use the following line of code:

Code: Select all

ReefAngel.Relay.Set(Port1,ReefAngel.IO.GetChannel(0));
to monitor a float valve and turn off a pump if it triggers. It worked beautifully last time, but had some consistency problems.

What I'd like to do this time is add the buzzer to it so if it triggers it will scream! I will plug the buzzer into probably ATO High, since I am not using it now. Appreciate your input as always.
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: straight forward float valve control

Post by rimai »

Try this:

Code: Select all

  ReefAngel.Relay.Set(Port1,ReefAngel.IO.GetChannel(0));
  pinMode(highATOPin,OUTPUT);
  digitalWrite(highATOPin,ReefAngel.IO.GetChannel(0)); 
Roberto.
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: straight forward float valve control

Post by rossbryant1956 »

rimai wrote:Try this:

Code: Select all

  ReefAngel.Relay.Set(Port1,ReefAngel.IO.GetChannel(0));
  pinMode(highATOPin,OUTPUT);
  digitalWrite(highATOPin,ReefAngel.IO.GetChannel(0)); 
Got around to doing this and it doesn't work. I had originally changed the port1 designator to port8 because that is the actual port I am hoping to toggle. In addition when I plugged in my buzzer prior to uploading this piece of code I could hear a faint but distinctive tone coming from the buzzer

After uploading the buzzer rings continuously regardless of the float valve position and the port does not toggle at all. Wondering if my port8 was being effected by the fact it's set as always on and was overriding my code to toggle it, I changed my code to another unused port (port1) and hooked up a lamp to it. Additionally I tried to do a:

Code: Select all

ReefAngel.Relay.Set(box1_Port1,ReefAngel.IO.GetChannel(0));
and that wouldn't even compile.

After uploading that I have determined the code above doesn't work because it still won't toggle the port. Please advise and and always, thx in advance.
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: straight forward float valve control

Post by rimai »

I don't think you are using the I/O module at all, are you?
I can't see it on your log.
I believe the controller is not even seeing it.
Where do you have the module connected to?
Have you tried the CustomMainScreen_IOExpansion code?
File->Sketchbook->Example Codes->CustomMainScreen_IOExpansion
Roberto.
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: straight forward float valve control

Post by rossbryant1956 »

rimai wrote:I don't think you are using the I/O module at all, are you?
I can't see it on your log.
I believe the controller is not even seeing it.
Where do you have the module connected to?
Have you tried the CustomMainScreen_IOExpansion code?
File->Sketchbook->Example Codes->CustomMainScreen_IOExpansion
from the bottom up:

1. I ran the test script, it loads, all are red, nothing happens f I toggle the one float valve plugged in
2. features.h has the two custom main and io command as stated
3. module is connected as it always was, from the i/o to the expansion hub to the relay expansion module.

Here is my code in case it is here:

Code: Select all

// Autogenerated file by RAGen (v1.2.1.158), (02/17/2012 22:55)

#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 <IO.h>
#include <ReefAngel.h>

void setup()
{
    ReefAngel.Init();  //Initialize controller
    ReefAngel.FeedingModePorts = Port5Bit | Port6Bit | Port8Bit; // Turn off Port 5, Port 6, Port8 when feeding mode is activated
    ReefAngel.WaterChangePorts = Port5Bit | Port6Bit | Port7Bit | Port8Bit; // Turn off Port5, Port6, Port7 and Port8 when water change mode is activated
    ReefAngel.TempProbe = T2_PROBE;  // Set the 1st plug (which acts like the 2nd plug) 
    ReefAngel.OverheatProbe = T2_PROBE;  // to monitor the overheat and temperatures
    ReefAngel.Relay.On(Port8); // Turn on Pump
}

void loop()
{
    // Specific functions
    ReefAngel.StandardLights(Port2,8,00,23,00); // Regular Lights on at 8:00am and off at 11:00pm
    ReefAngel.StandardLights(Port3,00,30,03,30); // Moon Lights on at 12:30am and off at 3:30am
    ReefAngel.StandardLights(Port4,23,30,14,30);  //Refugium schedule 11:30pm - 2:30pm
    ReefAngel.Wavemaker1(Port5);
    ReefAngel.Wavemaker2(Port6);
    ReefAngel.StandardHeater(Port7);
    // Randomize the Timer
	static time_t timer=now()+15;
	if (now()>timer)
	{
		timer=now()+random(15, 60);
	}
	ReefAngel.WavemakerToggle(Port5, Port6, timer);
    // turn on port 7 when temp falls below 76.0 and turn off when temp gets above 80.0
    if (ReefAngel.Params.Temp[T2_PROBE] <= 780 && ReefAngel.Params.Temp[T2_PROBE] > 0) ReefAngel.Relay.On(Port7); 
    if (ReefAngel.Params.Temp[T2_PROBE] >= 791) ReefAngel.Relay.Off(Port7);
    if (ReefAngel.Params.Temp[T1_PROBE] <= 780 && ReefAngel.Params.Temp[T1_PROBE] > 0) ReefAngel.Relay.On(Box1_Port1);
    if (ReefAngel.Params.Temp[T1_PROBE] >= 791) ReefAngel.Relay.Off(Box1_Port1);
    // if the hour is 8a or 6p, minute is 55 and seconds is 0
	// start the feeding mode
		if ( ((hour() == 8) || (hour() == 14) || (hour() == 20)) && 
		(minute() == 55) && 
		(second() == 0) ) 
                {
		ReefAngel.FeedingModeStart();
		}	
     //turn off port 8 - main pump when switch is tripped and sound buzzer 
     ReefAngel.Relay.Set(Port1,ReefAngel.IO.GetChannel(0));
     //pinMode(highATOPin,OUTPUT);
     //digitalWrite(highATOPin,ReefAngel.IO.GetChannel(0)); 
   
    ReefAngel.Portal("rossbryant1956");
    ReefAngel.ShowInterface();
}
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: straight forward float valve control

Post by rimai »

Is the hub plugged into the main box or expansion box?
You must connect to main box.
Roberto.
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: straight forward float valve control

Post by rossbryant1956 »

main box to the hub. From the hub port 1 to relay expansion module to box1. From the hub port2 to the I/O controller.

Is this correct?

I just read this again....do you mean the i/o must be plugged into the main box to run the test?

The details on line1 of this comment are how the unit is wired up in production. Thx
Last edited by rossbryant1956 on Sat Jun 23, 2012 2:20 pm, edited 1 time in total.
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: straight forward float valve control

Post by rimai »

Can you load this code?

Code: Select all

/**
 * I2CScanner.pde -- I2C bus scanner for Arduino
 *
 * 2009, Tod E. Kurt, http://todbot.com/blog/
 *
 */

#include "Wire.h"
extern "C" { 
#include "utility/twi.h"  // from Wire library, so we can do bus scanning
}

// Scan the I2C bus between addresses from_addr and to_addr.
// On each address, call the callback function with the address and result.
// If result==0, address was found, otherwise, address wasn't found
// (can use result to potentially get other status on the I2C bus, see twi.c)
// Assumes Wire.begin() has already been called
void scanI2CBus(byte from_addr, byte to_addr, 
                void(*callback)(byte address, byte result) ) 
{
  byte rc;
  byte data = 0; // not used, just an address to feed to twi_writeTo()
  for( byte addr = from_addr; addr <= to_addr; addr++ ) {
    rc = twi_writeTo(addr, &data, 0, 1);
    callback( addr, rc );
  }
}

// Called when address is found in scanI2CBus()
// Feel free to change this as needed
// (like adding I2C comm code to figure out what kind of I2C device is there)
void scanFunc( byte addr, byte result ) {
  Serial.print("addr: ");
  Serial.print(addr,HEX);
  Serial.print( (result==0) ? " found!":"       ");
  Serial.print( (addr%4) ? "\t":"\n");
}


byte start_address = 1;
byte end_address = 128;

// standard Arduino setup()
void setup()
{
    Wire.begin();

    Serial.begin(57600);
    Serial.println("\nI2CScanner ready!");

    Serial.print("starting scanning of I2C bus from ");
    Serial.print(start_address,DEC);
    Serial.print(" to ");
    Serial.print(end_address,DEC);
    Serial.println("...");

    // start the scan, will call "scanFunc()" on result from each address
    scanI2CBus( start_address, end_address, scanFunc );

    Serial.println("\ndone");
}

// standard Arduino loop()
void loop() 
{
    // Nothing to do here, so we'll just blink the built-in LED
    digitalWrite(7,HIGH);
    delay(300);
    digitalWrite(7,LOW);
    delay(300);
}
Then open Tools->Serial Monitor, make sure that it is baud 57600 and paste the result here?
Roberto.
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: straight forward float valve control

Post by rossbryant1956 »

won't compile:


The following feature was automatically added:
Watchdog Timer
Version Menu

The following features were detected:
Simple Menu
C:\Program Files (x86)\Reef Angel Controller\libraries\Wire/utility/twi.h: In function 'void scanI2CBus(byte, byte, void (*)(byte, byte))':
C:\Program Files (x86)\Reef Angel Controller\libraries\Wire/utility/twi.h:44: error: too few arguments to function 'uint8_t twi_writeTo(uint8_t, uint8_t*, uint8_t, uint8_t, uint8_t)'
sketch_jun23a:23: error: at this point in file
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: straight forward float valve control

Post by rossbryant1956 »

bump. Any ideas?
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: straight forward float valve control

Post by rimai »

Sorry, the Arduino team changed the wire library.
Use this:

Code: Select all

/**
 * I2CScanner.pde -- I2C bus scanner for Arduino
 *
 * 2009, Tod E. Kurt, http://todbot.com/blog/
 *
 */

#include "Wire.h"
extern "C" { 
#include "utility/twi.h"  // from Wire library, so we can do bus scanning
}

// Scan the I2C bus between addresses from_addr and to_addr.
// On each address, call the callback function with the address and result.
// If result==0, address was found, otherwise, address wasn't found
// (can use result to potentially get other status on the I2C bus, see twi.c)
// Assumes Wire.begin() has already been called
void scanI2CBus(byte from_addr, byte to_addr, 
void(*callback)(byte address, byte result) ) 
{
  byte rc;
  byte data = 0; // not used, just an address to feed to twi_writeTo()
  for( byte addr = from_addr; addr <= to_addr; addr++ ) {
    rc = twi_writeTo(addr, &data, 0, 1, true);
    callback( addr, rc );
  }
}

// Called when address is found in scanI2CBus()
// Feel free to change this as needed
// (like adding I2C comm code to figure out what kind of I2C device is there)
void scanFunc( byte addr, byte result ) {
  Serial.print("addr: ");
  Serial.print(addr,HEX);
  Serial.print( (result==0) ? " found!":"       ");
  Serial.print( (addr%4) ? "\t":"\n");
}


byte start_address = 1;
byte end_address = 128;

// standard Arduino setup()
void setup()
{
  Wire.begin();
  pinMode(7,OUTPUT);
  Serial.begin(57600);
  Serial.println("\nI2CScanner ready!");

  Serial.print("starting scanning of I2C bus from ");
  Serial.print(start_address,DEC);
  Serial.print(" to ");
  Serial.print(end_address,DEC);
  Serial.println("...");

  // start the scan, will call "scanFunc()" on result from each address
  scanI2CBus( start_address, end_address, scanFunc );

  Serial.println("\ndone");
}

// standard Arduino loop()
void loop() 
{
  // Nothing to do here, so we'll just blink the built-in LED
  digitalWrite(7,HIGH);
  delay(300);
  digitalWrite(7,LOW);
  delay(300);
}
Roberto.
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: straight forward float valve control

Post by rossbryant1956 »

Thx Roberto:

Code: Select all

I2CScanner ready!
starting scanning of I2C bus from 1 to 128...
addr: 1       	addr: 2       	addr: 3       	addr: 4       
addr: 5       	addr: 6       	addr: 7       	addr: 8       
addr: 9 found!	addr: A       	addr: B       	addr: C       
addr: D       	addr: E       	addr: F       	addr: 10       
addr: 11       	addr: 12       	addr: 13       	addr: 14       
addr: 15       	addr: 16       	addr: 17       	addr: 18       
addr: 19       	addr: 1A       	addr: 1B       	addr: 1C       
addr: 1D       	addr: 1E       	addr: 1F       	addr: 20 found!
addr: 21       	addr: 22       	addr: 23       	addr: 24       
addr: 25       	addr: 26       	addr: 27       	addr: 28       
addr: 29       	addr: 2A       	addr: 2B       	addr: 2C       
addr: 2D       	addr: 2E       	addr: 2F       	addr: 30       
addr: 31       	addr: 32       	addr: 33       	addr: 34       
addr: 35       	addr: 36       	addr: 37       	addr: 38 found!
addr: 39       	addr: 3A       	addr: 3B       	addr: 3C       
addr: 3D       	addr: 3E       	addr: 3F       	addr: 40       
addr: 41       	addr: 42       	addr: 43       	addr: 44       
addr: 45       	addr: 46       	addr: 47       	addr: 48       
addr: 49       	addr: 4A       	addr: 4B       	addr: 4C       
addr: 4D       	addr: 4E       	addr: 4F       	addr: 50 found!
addr: 51       	addr: 52       	addr: 53       	addr: 54 found!
addr: 55       	addr: 56       	addr: 57       	addr: 58       
addr: 59       	addr: 5A       	addr: 5B       	addr: 5C       
addr: 5D       	addr: 5E       	addr: 5F       	addr: 60       
addr: 61       	addr: 62       	addr: 63       	addr: 64       
addr: 65       	addr: 66       	addr: 67       	addr: 68 found!
addr: 69       	addr: 6A       	addr: 6B       	addr: 6C       
addr: 6D       	addr: 6E       	addr: 6F       	addr: 70       
addr: 71       	addr: 72       	addr: 73       	addr: 74       
addr: 75       	addr: 76       	addr: 77       	addr: 78       
addr: 79       	addr: 7A       	addr: 7B       	addr: 7C       
addr: 7D       	addr: 7E       	addr: 7F       	addr: 80       

done
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: straight forward float valve control

Post by rimai »

Ok, so I know the module is being seen by the controller.
How do you have the float switch on channel 0 wired up?
Is it like this:
Image
Roberto.
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: straight forward float valve control

Post by rossbryant1956 »

there is my possible problem, will fix later today. Ground wire is plugged into the power connection (last on right) not second or third to right...

Do you think this will potentially fix my buzzer issue as well (low hum when plugged before uploading) constant load hum after?

THx
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: straight forward float valve control

Post by rossbryant1956 »

took the extra minute. That works. Will play more later. Appreciate the answer on the buzzer for later
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: straight forward float valve control

Post by rimai »

The faint hum is because the pin is setup as input by default and has a internal pull-up, which causes it to have a very weak draw of current if you use it as output.
Does it buzz when you use the float switch?
Roberto.
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: straight forward float valve control

Post by rossbryant1956 »

The buzzer works great, the low hum is gone when wired up properly...there is just one problem ;)

It is completely backward. It buzzes when the float valve is not tripped, and turns off when the float valve is tripped. Pls help me correct this wayward buzzer...

Thx as always
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: straight forward float valve control

Post by rimai »

Cool.
Just add an exclamation mark :)

Code: Select all

digitalWrite(highATOPin,!ReefAngel.IO.GetChannel(0)); 
Roberto.
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: straight forward float valve control

Post by rossbryant1956 »

thx, buddy, works like a charm.
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: straight forward float valve control

Post by rossbryant1956 »

Well, I built my bracket, installed everything, and it works like a charm. However, the buzzer is not very loud. It is plugged into ato high, as described earlier,

Is there a way to make it louder, or does someone sell one that will SCREAM when this float valve triggers? :shock:

Thx, as always, in advance.
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: straight forward float valve control

Post by rimai »

You can get a little bit louder if you use one of the PWM ports.
ATO ports = 5V
PWM ports = 10V
But if you need something much louder, you will need to use on of the relay ports and a stand alone buzzer.
Roberto.
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: straight forward float valve control

Post by rossbryant1956 »

rimai wrote:You can get a little bit louder if you use one of the PWM ports.
ATO ports = 5V
PWM ports = 10V
But if you need something much louder, you will need to use on of the relay ports and a stand alone buzzer.
So then...how would I change this line of code:

Code: Select all

 //turn off port 8 - main pump when switch is tripped and sound buzzer 
     ReefAngel.Relay.Set(Port8,ReefAngel.IO.GetChannel(0));
     pinMode(highATOPin,OUTPUT);
     digitalWrite(highATOPin,!ReefAngel.IO.GetChannel(0)); 
to use the pwm port. Thx in advance
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: straight forward float valve control

Post by rimai »

Which port would you want to use? Actinic or Daylight?
Roberto.
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: straight forward float valve control

Post by rossbryant1956 »

daylight
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: straight forward float valve control

Post by rimai »

Replace the above with this:

Code: Select all

//turn off port 8 - main pump when switch is tripped and sound buzzer 
     ReefAngel.Relay.Set(Port8,ReefAngel.IO.GetChannel(0));
     ReefAngel.PWM.SetDaylight(ReefAngel.IO.GetChannel(0)*100); 
Roberto.
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: straight forward float valve control

Post by rossbryant1956 »

rimai wrote:Replace the above with this:

Code: Select all

//turn off port 8 - main pump when switch is tripped and sound buzzer 
     ReefAngel.Relay.Set(Port8,ReefAngel.IO.GetChannel(0));
     ReefAngel.PWM.SetDaylight(ReefAngel.IO.GetChannel(0)*100); 
This ALMOST works. I put in the line of code and now the buzzer screams when the switch is NOT TRIPPED rather than when it is. I tested by tripping the switch and it turned off. I probably need a !, but not sure where to put it. Thx
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: straight forward float valve control

Post by rimai »

Try this:

Code: Select all

//turn off port 8 - main pump when switch is tripped and sound buzzer 
     ReefAngel.Relay.Set(Port8,ReefAngel.IO.GetChannel(0));
     ReefAngel.PWM.SetDaylight(100-(ReefAngel.IO.GetChannel(0)*100)); 
Roberto.
Post Reply