help with basic relay control

I get the following :

error: expected unqualified-id before '{' token

here is my code

/***********************************************************************************


   Wiring
   Pin 2 - Float Switch A51
   Pin 3 - Float Switch A99
   Pin 4 - Float Switch B51
   Pin 5 - Float Switch B99
   Pin 6 - selenoid valve 1
   Pin 7 - selenoid valve 1
   Pin 8 - selenoid valve 1
   Pin 9 - selenoid valve 1
   Pin 10 -  LED

   Control Behavior:
    liquid comes in through a manifold under vaccum to 2 tanks (A,B)
    Vaccum is pulled in both tanks trhough selenoid valves 1 and 2
    tanks are emptied via gravity flap once pressure equalise with the atmosphere.
    pressure is equalised using selenoid valve 3 and 4
    tanks are fed liquid through check valves from the manifold
    tanks have 2 float switches each one at 51% capacity one at 99% capacity

    behaviour is as follow: as tank A reaches 51% liquid level vacuum is started to be pulled from tank B
    tanks get liquid equally until tank A reaches 99%
    tank A no longuer has vacuum pulled and equalise pressure, releasing liquid
    tank B keeps filling up until 51% then vaccuum is pulled on tank A

   External Resources

***********************************************************************************/
//define the input/output pins
#define A51FLOAT_SWITCH_PIN 2
#define A99FLOAT_SWITCH_PIN 3
#define B51FLOAT_SWITCH_PIN 4
#define B99FLOAT_SWITCH_PIN 5
#define Valve_1_PIN 6
#define Valve_2_PIN 7
#define Valve_3_PIN 8
#define Valve_4_PIN 9
#define LED_PIN 10

//setup runs once
void setup()
{
 //setup input pins for float switch
 //Too use a bare switch with no external pullup resistor, set the pin mode to INPUT_PULLUP to use internal pull resistors. This will invert the standard high/low behavior
 pinMode(A51FLOAT_SWITCH_PIN, INPUT_PULLUP);
 pinMode(A99FLOAT_SWITCH_PIN, INPUT_PULLUP);
 pinMode(B51FLOAT_SWITCH_PIN, INPUT_PULLUP);
 pinMode(B99FLOAT_SWITCH_PIN, INPUT_PULLUP);


 //setup output pins for relays/pumping station and LED board
 pinMode(Valve_1_PIN, OUTPUT);
 pinMode(Valve_2_PIN, OUTPUT);
 pinMode(Valve_3_PIN, OUTPUT);
 pinMode(Valve_4_PIN, OUTPUT);
 pinMode(LED_PIN, OUTPUT);

}

//loop() runs indefinitely
void loop()
{


 //check to see the state of the float switches. These states are assuming the pin is using an internal pullup resistor.
 // LOW corresdponds to the float switch being at its lowest point (i.e. low water)
 //empty
 if (digitalRead(A51FLOAT_SWITCH_PIN) == LOW);
 if (digitalRead(A99FLOAT_SWITCH_PIN) == LOW);
 if (digitalRead(B51FLOAT_SWITCH_PIN) == LOW);
 if (digitalRead(B99FLOAT_SWITCH_PIN) == LOW);

 digitalWrite(Valve_1_PIN, HIGH); //open vacuum to A
 digitalWrite(Valve_2_PIN, LOW); //open vacuum to B
 digitalWrite(Valve_3_PIN, LOW); //purge A
 digitalWrite(Valve_2_PIN, LOW); //purge B
 digitalWrite(LED_PIN, HIGH);    //turn on the LED
}
{
 //check to see the state of the float switches. These states are assuming the pin is using an internal pullup resistor.
 // LOW corresdponds to the float switch being at its lowest point (i.e. low water)
 //a51
 if (digitalRead(A51FLOAT_SWITCH_PIN) == HIGH);
 if (digitalRead(A99FLOAT_SWITCH_PIN) == LOW);
 if (digitalRead(B51FLOAT_SWITCH_PIN) == LOW);
 if (digitalRead(B99FLOAT_SWITCH_PIN) == LOW);

 digitalWrite(Valve_1_PIN, HIGH); //open vacuum to A
 digitalWrite(Valve_2_PIN, HIGH); //open vacuum to B
 digitalWrite(Valve_3_PIN, LOW); //purge A
 digitalWrite(Valve_2_PIN, LOW); //purge B
 digitalWrite(LED_PIN, HIGH);    //turn on the LED
}
{
 //check to see the state of the float switches. These states are assuming the pin is using an internal pullup resistor.
 // LOW corresdponds to the float switch being at its lowest point (i.e. low water)
 //a99
 if (digitalRead(A51FLOAT_SWITCH_PIN) == HIGH);
 if (digitalRead(A99FLOAT_SWITCH_PIN) == HIGH);
 if (digitalRead(B51FLOAT_SWITCH_PIN) == LOW);
 if (digitalRead(B99FLOAT_SWITCH_PIN) == LOW);

 digitalWrite(Valve_1_PIN, LOW); //open vacuum to A
 digitalWrite(Valve_2_PIN, HIGH); //open vacuum to B
 digitalWrite(Valve_3_PIN, HIGH); //purge A
 digitalWrite(Valve_2_PIN, LOW); //purge B
 digitalWrite(LED_PIN, HIGH);    //turn on the LED
}
{
 //check to see the state of the float switches. These states are assuming the pin is using an internal pullup resistor.
 // LOW corresdponds to the float switch being at its lowest point (i.e. low water)
 //b51
 if (digitalRead(A51FLOAT_SWITCH_PIN) == LOW);
 if (digitalRead(A99FLOAT_SWITCH_PIN) == LOW);
 if (digitalRead(B51FLOAT_SWITCH_PIN) == HIGH);
 if (digitalRead(B99FLOAT_SWITCH_PIN) == LOW);

 digitalWrite(Valve_1_PIN, HIGH); //open vacuum to A
 digitalWrite(Valve_2_PIN, HIGH); //open vacuum to B
 digitalWrite(Valve_3_PIN, LOW); //purge A
 digitalWrite(Valve_2_PIN, LOW); //purge B
 digitalWrite(LED_PIN, HIGH);    //turn on the LED
}
{
 //check to see the state of the float switches. These states are assuming the pin is using an internal pullup resistor.
 // LOW corresdponds to the float switch being at its lowest point (i.e. low water)
 //b99
 if (digitalRead(A51FLOAT_SWITCH_PIN) == LOW);
 if (digitalRead(A99FLOAT_SWITCH_PIN) == LOW);
 if (digitalRead(B51FLOAT_SWITCH_PIN) == HIGH);
 if (digitalRead(B99FLOAT_SWITCH_PIN) == HIGH);

 digitalWrite(Valve_1_PIN, HIGH); //open vacuum to A
 digitalWrite(Valve_2_PIN, LOW); //open vacuum to B
 digitalWrite(Valve_3_PIN, LOW); //purge A
 digitalWrite(Valve_2_PIN, HIGH); //purge B
 digitalWrite(LED_PIN, HIGH);    //turn on the LED
}
{
 //check to see the state of the float switches. These states are assuming the pin is using an internal pullup resistor.
 // LOW corresdponds to the float switch being at its lowest point (i.e. low water)
 if (digitalRead(A51FLOAT_SWITCH_PIN) == LOW);
 if (digitalRead(A99FLOAT_SWITCH_PIN) == LOW);
 if (digitalRead(B51FLOAT_SWITCH_PIN) == HIGH);
 if (digitalRead(B99FLOAT_SWITCH_PIN) == LOW);

 digitalWrite(Valve_1_PIN, HIGH); //open vacuum to A
 digitalWrite(Valve_2_PIN, HIGH); //open vacuum to B
 digitalWrite(Valve_3_PIN, LOW); //purge A
 digitalWrite(Valve_2_PIN, LOW); //purge B
 digitalWrite(LED_PIN, HIGH);    //turn on the LED
}

Please edit your post and place [code] before your code and [/code] after it. So it looks like your code here

Several issues here:

void loop()
{


  //check to see the state of the float switches. These states are assuming the pin is using an internal pullup resistor.
  // LOW corresdponds to the float switch being at its lowest point (i.e. low water)
  //empty
  if (digitalRead(A51FLOAT_SWITCH_PIN) == LOW);
  if (digitalRead(A99FLOAT_SWITCH_PIN) == LOW);
  if (digitalRead(B51FLOAT_SWITCH_PIN) == LOW);
  if (digitalRead(B99FLOAT_SWITCH_PIN) == LOW);

  digitalWrite(Valve_1_PIN, HIGH); //open vacuum to A
  digitalWrite(Valve_2_PIN, LOW); //open vacuum to B
  digitalWrite(Valve_3_PIN, LOW); //purge A
  digitalWrite(Valve_2_PIN, LOW); //purge B
  digitalWrite(LED_PIN, HIGH);    //turn on the LED
}
{

That final opening brace is outside of any function which is why the compiler is complaining.

Adding to your woes, the semi-colon on each of your if statements makes each of them say

if(Condition)
  /* Do nothing */
  if (digitalRead(A51FLOAT_SWITCH_PIN) == LOW);
  if (digitalRead(A99FLOAT_SWITCH_PIN) == LOW);
  if (digitalRead(B51FLOAT_SWITCH_PIN) == LOW);
  if (digitalRead(B99FLOAT_SWITCH_PIN) == LOW);

What code is executed if any of these conditions is true ?

Where is the end of the loop() function ?

Ignoring the later cases, is this what you mean for the empty case?

void loop()
{
  //check to see the state of the float switches. These states are assuming the pin is using an internal pullup resistor.
  // LOW corresdponds to the float switch being at its lowest point (i.e. low water)
  //empty
  if ((digitalRead(A51FLOAT_SWITCH_PIN) == LOW) &&
     (digitalRead(A99FLOAT_SWITCH_PIN) == LOW) &&
     (digitalRead(B51FLOAT_SWITCH_PIN) == LOW) &&
     (digitalRead(B99FLOAT_SWITCH_PIN) == LOW)) 
       {
       digitalWrite(Valve_1_PIN, HIGH); //open vacuum to A
       digitalWrite(Valve_2_PIN, LOW); //open vacuum to B
       digitalWrite(Valve_3_PIN, LOW); //purge A
       digitalWrite(Valve_2_PIN, LOW); //purge B
       digitalWrite(LED_PIN, HIGH);    //turn on the LED
       }
}

wildbill:
Ignoring the later cases, is this what you mean for the empty case?

void loop()

{
  //check to see the state of the float switches. These states are assuming the pin is using an internal pullup resistor.
  // LOW corresdponds to the float switch being at its lowest point (i.e. low water)
  //empty
  if ((digitalRead(A51FLOAT_SWITCH_PIN) == LOW) &&
    (digitalRead(A99FLOAT_SWITCH_PIN) == LOW) &&
    (digitalRead(B51FLOAT_SWITCH_PIN) == LOW) &&
    (digitalRead(B99FLOAT_SWITCH_PIN) == LOW))
      {
      digitalWrite(Valve_1_PIN, HIGH); //open vacuum to A
      digitalWrite(Valve_2_PIN, LOW); //open vacuum to B
      digitalWrite(Valve_3_PIN, LOW); //purge A
      digitalWrite(Valve_2_PIN, LOW); //purge B
      digitalWrite(LED_PIN, HIGH);    //turn on the LED
      }
}

yes basically....

/***********************************************************************************


    Wiring
    Pin 2 - Float Switch A51
    Pin 3 - Float Switch A99
    Pin 4 - Float Switch B51
    Pin 5 - Float Switch B99
    Pin 6 - selenoid valve 1
    Pin 7 - selenoid valve 1
    Pin 8 - selenoid valve 1
    Pin 9 - selenoid valve 1
    Pin 10 -  LED

    Control Behavior:
     liquid comes in through a manifold under vaccum to 2 tanks (A,B)
     Vaccum is pulled in both tanks trhough selenoid valves 1 and 2
     tanks are emptied via gravity flap once pressure equalise with the atmosphere.
     pressure is equalised using selenoid valve 3 and 4
     tanks are fed liquid through check valves from the manifold
     tanks have 2 float switches each one at 51% capacity one at 99% capacity

     behaviour is as follow: as tank A reaches 51% liquid level vacuum is started to be pulled from tank B
     tanks get liquid equally until tank A reaches 99%
     tank A no longuer has vacuum pulled and equalise pressure, releasing liquid
     tank B keeps filling up until 51% then vaccuum is pulled on tank A

    External Resources

 ***********************************************************************************/
//define the input/output pins
#define A51FLOAT_SWITCH_PIN 2
#define A99FLOAT_SWITCH_PIN 3
#define B51FLOAT_SWITCH_PIN 4
#define B99FLOAT_SWITCH_PIN 5
#define Valve_1_PIN 6
#define Valve_2_PIN 7
#define Valve_3_PIN 8
#define Valve_4_PIN 9
#define LED_PIN 10

//setup runs once
void setup()
{
  //setup input pins for float switch
  //Too use a bare switch with no external pullup resistor, set the pin mode to INPUT_PULLUP to use internal pull resistors. This will invert the standard high/low behavior
  pinMode(A51FLOAT_SWITCH_PIN, INPUT_PULLUP);
  pinMode(A99FLOAT_SWITCH_PIN, INPUT_PULLUP);
  pinMode(B51FLOAT_SWITCH_PIN, INPUT_PULLUP);
  pinMode(B99FLOAT_SWITCH_PIN, INPUT_PULLUP);


  //setup output pins for relays/pumping station and LED board
  pinMode(Valve_1_PIN, OUTPUT);
  pinMode(Valve_2_PIN, OUTPUT);
  pinMode(Valve_3_PIN, OUTPUT);
  pinMode(Valve_4_PIN, OUTPUT);
  pinMode(LED_PIN, OUTPUT);

}

//loop() runs indefinitely
void loop()
{


  //check to see the state of the float switches. These states are assuming the pin is using an internal pullup resistor.
  // LOW corresdponds to the float switch being at its lowest point (i.e. low water)
  //empty
  if ((digitalRead(A51FLOAT_SWITCH_PIN) == LOW)&&
   (digitalRead(A99FLOAT_SWITCH_PIN) == LOW)&&
   (digitalRead(B51FLOAT_SWITCH_PIN) == LOW)&&
   (digitalRead(B99FLOAT_SWITCH_PIN) == LOW))

  digitalWrite(Valve_1_PIN, HIGH); //open vacuum to A
  digitalWrite(Valve_2_PIN, LOW); //open vacuum to B
  digitalWrite(Valve_3_PIN, LOW); //purge A
  digitalWrite(Valve_2_PIN, LOW); //purge B
  digitalWrite(LED_PIN, HIGH);    //turn on the LED

  //A51
  if ((digitalRead(A51FLOAT_SWITCH_PIN) == HIGH)&&
   (digitalRead(A99FLOAT_SWITCH_PIN) == LOW)&&
   (digitalRead(B51FLOAT_SWITCH_PIN) == LOW)&&
   (digitalRead(B99FLOAT_SWITCH_PIN) == LOW))

  digitalWrite(Valve_1_PIN, HIGH); //open vacuum to A
  digitalWrite(Valve_2_PIN, HIGH); //open vacuum to B
  digitalWrite(Valve_3_PIN, LOW); //purge A
  digitalWrite(Valve_2_PIN, LOW); //purge B
  digitalWrite(LED_PIN, HIGH);    //turn on the LED

  //A99

    if ((digitalRead(A51FLOAT_SWITCH_PIN) == HIGH)&&
   (digitalRead(A99FLOAT_SWITCH_PIN) == HIGH)&&
   (digitalRead(B51FLOAT_SWITCH_PIN) == LOW)&&
   (digitalRead(B99FLOAT_SWITCH_PIN) == LOW))

  digitalWrite(Valve_1_PIN, LOW); //open vacuum to A
  digitalWrite(Valve_2_PIN, HIGH); //open vacuum to B
  digitalWrite(Valve_3_PIN, HIGH); //purge A
  digitalWrite(Valve_2_PIN, LOW); //purge B
  digitalWrite(LED_PIN, HIGH);    //turn on the LED

  //B51

    if ((digitalRead(A51FLOAT_SWITCH_PIN) == LOW)&&
   (digitalRead(A99FLOAT_SWITCH_PIN) == LOW)&&
   (digitalRead(B51FLOAT_SWITCH_PIN) == HIGH)&&
   (digitalRead(B99FLOAT_SWITCH_PIN) == LOW))

  digitalWrite(Valve_1_PIN, HIGH); //open vacuum to A
  digitalWrite(Valve_2_PIN, HIGH); //open vacuum to B
  digitalWrite(Valve_3_PIN, LOW); //purge A
  digitalWrite(Valve_2_PIN, LOW); //purge B
  digitalWrite(LED_PIN, HIGH);    //turn on the LED

  //B99

    if ((digitalRead(A51FLOAT_SWITCH_PIN) == LOW)&&
   (digitalRead(A99FLOAT_SWITCH_PIN) == LOW)&&
   (digitalRead(B51FLOAT_SWITCH_PIN) == HIGH)&&
   (digitalRead(B99FLOAT_SWITCH_PIN) == HIGH))

  digitalWrite(Valve_1_PIN, HIGH); //open vacuum to A
  digitalWrite(Valve_2_PIN, LOW); //open vacuum to B
  digitalWrite(Valve_3_PIN, LOW); //purge A
  digitalWrite(Valve_2_PIN, HIGH); //purge B
  digitalWrite(LED_PIN, HIGH);    //turn on the LED

  
}

Does the above code make more sense?

now the only downside to this is that its missing a delay, as the liquid drains, the 51% float switch will go low before the tank is empty. how can I add a delay to make sure the tank empties.

How can I tell the relay output to stay HIGH for x seconds after being triggered by A99 or B99, regardless of the low status of A51 or B51?

thanks tons, im a better plumber than programmer !

Does the above code make more sense?

No

 if ((digitalRead(A51FLOAT_SWITCH_PIN) == LOW)&&
   (digitalRead(A99FLOAT_SWITCH_PIN) == LOW)&&
   (digitalRead(B51FLOAT_SWITCH_PIN) == LOW)&&
   (digitalRead(B99FLOAT_SWITCH_PIN) == LOW))

  digitalWrite(Valve_1_PIN, HIGH); //open vacuum to A
  digitalWrite(Valve_2_PIN, LOW); //open vacuum to B
  digitalWrite(Valve_3_PIN, LOW); //purge A
  digitalWrite(Valve_2_PIN, LOW); //purge B
  digitalWrite(LED_PIN, HIGH);    //turn on the LED

I assume that you believe that the last 5 lines above will be executed if the conditions are all true. If so then you are wrong. Ask yourself how the program knows which lines of code to execute when the conditions are true.

Formatting the code differently may make your mistake clearer

  if ((digitalRead(A51FLOAT_SWITCH_PIN) == LOW) &&
      (digitalRead(A99FLOAT_SWITCH_PIN) == LOW) &&
      (digitalRead(B51FLOAT_SWITCH_PIN) == LOW) &&
      (digitalRead(B99FLOAT_SWITCH_PIN) == LOW))

    digitalWrite(Valve_1_PIN, HIGH); //open vacuum to A
  digitalWrite(Valve_2_PIN, LOW); //open vacuum to B
  digitalWrite(Valve_3_PIN, LOW); //purge A
  digitalWrite(Valve_2_PIN, LOW); //purge B
  digitalWrite(LED_PIN, HIGH);    //turn on the LED

UKHeliBob:
No

I assume that you believe that the last 5 lines above will be executed if the conditions are all true. If so then you are wrong. Ask yourself how the program knows which lines of code to execute when the conditions are true.

Formatting the code differently may make your mistake clearer

youre not helping me there!

how do I make sure all 5 line get executed if all 4 statements are true?

With these { }

Please remember to use code tags when posting code.

AWOL:
With these { }

where would they go ?

if ((digitalRead(A51FLOAT_SWITCH_PIN) == LOW)&&
   (digitalRead(A99FLOAT_SWITCH_PIN) == LOW)&&
   (digitalRead(B51FLOAT_SWITCH_PIN) == LOW)&&
   (digitalRead(B99FLOAT_SWITCH_PIN) == LOW))

 {
  digitalWrite(Valve_1_PIN, HIGH); //open vacuum to A
  digitalWrite(Valve_2_PIN, LOW); //open vacuum to B
  digitalWrite(Valve_3_PIN, LOW); //purge A
  digitalWrite(Valve_2_PIN, LOW); //purge B
  digitalWrite(LED_PIN, HIGH);    //turn on the LED
 }

like this?

sorry guys, I have absolutely no programming experience.

that's it

if I want the atmospheric pressure equalisation solenoid to only stay open 5 seconds is the following good ?

#include <LiquidCrystal.h>

#include <EEPROM.h>

/***********************************************************************************


    Wiring
    Pin 2 - Float Switch A51
    Pin 3 - Float Switch A99
    Pin 4 - Float Switch B51
    Pin 5 - Float Switch B99
    Pin 6 - selenoid valve 1
    Pin 7 - selenoid valve 1
    Pin 8 - selenoid valve 1
    Pin 9 - selenoid valve 1
    Pin 10 -  LED

    Control Behavior:
     liquid comes in through a manifold under vaccum to 2 tanks (A,B)
     Vaccum is pulled in both tanks trhough selenoid valves 1 and 2
     tanks are emptied via gravity flap once pressure equalise with the atmosphere.
     pressure is equalised using selenoid valve 3 and 4
     tanks are fed liquid through check valves from the manifold
     tanks have 2 float switches each one at 51% capacity one at 99% capacity

     behaviour is as follow: as tank A reaches 51% liquid level vacuum is started to be pulled from tank B
     tanks get liquid equally until tank A reaches 99%
     tank A no longuer has vacuum pulled and equalise pressure, releasing liquid
     tank B keeps filling up until 51% then vaccuum is pulled on tank A

    External Resources

 ***********************************************************************************/
//define the input/output pins
#define A51FLOAT_SWITCH_PIN 2
#define A99FLOAT_SWITCH_PIN 3
#define B51FLOAT_SWITCH_PIN 4
#define B99FLOAT_SWITCH_PIN 5
#define Valve_1_PIN 6
#define Valve_2_PIN 7
#define Valve_3_PIN 8
#define Valve_4_PIN 9
#define LED_PIN 10

//setup runs once
void setup()
{
  //setup input pins for float switch
  //Too use a bare switch with no external pullup resistor, set the pin mode to INPUT_PULLUP to use internal pull resistors. This will invert the standard high/low behavior
  pinMode(A51FLOAT_SWITCH_PIN, INPUT_PULLUP);
  pinMode(A99FLOAT_SWITCH_PIN, INPUT_PULLUP);
  pinMode(B51FLOAT_SWITCH_PIN, INPUT_PULLUP);
  pinMode(B99FLOAT_SWITCH_PIN, INPUT_PULLUP);


  //setup output pins for relays/pumping station and LED board
  pinMode(Valve_1_PIN, OUTPUT);
  pinMode(Valve_2_PIN, OUTPUT);
  pinMode(Valve_3_PIN, OUTPUT);
  pinMode(Valve_4_PIN, OUTPUT);
  pinMode(LED_PIN, OUTPUT);

}

//loop() runs indefinitely
void loop()
{


  //check to see the state of the float switches. These states are assuming the pin is using an internal pullup resistor.
  // LOW corresdponds to the float switch being at its lowest point (i.e. low water)
  //empty
  if ((digitalRead(A51FLOAT_SWITCH_PIN) == LOW) &&
      (digitalRead(A99FLOAT_SWITCH_PIN) == LOW) &&
      (digitalRead(B51FLOAT_SWITCH_PIN) == LOW) &&
      (digitalRead(B99FLOAT_SWITCH_PIN) == LOW))
  {
    digitalWrite(Valve_1_PIN, HIGH); //open vacuum to A
    digitalWrite(Valve_2_PIN, LOW); //open vacuum to B
    digitalWrite(Valve_3_PIN, LOW); //purge A
    digitalWrite(Valve_2_PIN, LOW); //purge B
    digitalWrite(LED_PIN, HIGH);    //turn on the LED
  }
  //A51
  if ((digitalRead(A51FLOAT_SWITCH_PIN) == HIGH) &&
      (digitalRead(A99FLOAT_SWITCH_PIN) == LOW) &&
      (digitalRead(B51FLOAT_SWITCH_PIN) == LOW) &&
      (digitalRead(B99FLOAT_SWITCH_PIN) == LOW))
  {
    digitalWrite(Valve_1_PIN, HIGH); //open vacuum to A
    digitalWrite(Valve_2_PIN, HIGH); //open vacuum to B
    digitalWrite(Valve_3_PIN, LOW); //purge A
    digitalWrite(Valve_2_PIN, LOW); //purge B
    digitalWrite(LED_PIN, HIGH);    //turn on the LED
  }
  //A99

  if ((digitalRead(A51FLOAT_SWITCH_PIN) == HIGH) &&
      (digitalRead(A99FLOAT_SWITCH_PIN) == HIGH) &&
      (digitalRead(B51FLOAT_SWITCH_PIN) == LOW) &&
      (digitalRead(B99FLOAT_SWITCH_PIN) == LOW))
  {
    digitalWrite(Valve_1_PIN, LOW); //open vacuum to A
    digitalWrite(Valve_2_PIN, HIGH); //open vacuum to B
    digitalWrite(Valve_3_PIN, HIGH); //purge A
    delay(5000);
    digitalWrite(Valve_3_PIN, LOW);
    digitalWrite(Valve_2_PIN, LOW); //purge B
    digitalWrite(LED_PIN, HIGH);    //turn on the LED
  }
  //B51

  if ((digitalRead(A51FLOAT_SWITCH_PIN) == LOW) &&
      (digitalRead(A99FLOAT_SWITCH_PIN) == LOW) &&
      (digitalRead(B51FLOAT_SWITCH_PIN) == HIGH) &&
      (digitalRead(B99FLOAT_SWITCH_PIN) == LOW))
  {
    digitalWrite(Valve_1_PIN, HIGH); //open vacuum to A
    digitalWrite(Valve_2_PIN, HIGH); //open vacuum to B
    digitalWrite(Valve_3_PIN, LOW); //purge A
    digitalWrite(Valve_2_PIN, LOW); //purge B
    digitalWrite(LED_PIN, HIGH);    //turn on the LED
  }
  //B99

  if ((digitalRead(A51FLOAT_SWITCH_PIN) == LOW) &&
      (digitalRead(A99FLOAT_SWITCH_PIN) == LOW) &&
      (digitalRead(B51FLOAT_SWITCH_PIN) == HIGH) &&
      (digitalRead(B99FLOAT_SWITCH_PIN) == HIGH))
  {
    digitalWrite(Valve_1_PIN, HIGH); //open vacuum to A
    digitalWrite(Valve_2_PIN, LOW); //open vacuum to B
    digitalWrite(Valve_3_PIN, LOW); //purge A
    digitalWrite(Valve_2_PIN, HIGH); //purge B
    delay(5000);
    digitalWrite(Valve_2_PIN, LOW); //purge B
    digitalWrite(LED_PIN, HIGH);    //turn on the LED
  }

}

this machine is used to release maple sap while keeping the maple lines under 3inHg.

maple syrup operations often have to build their own gear.... me included

Possibly, hard to say without a better understanding of your setup. Delay is what I was going to suggest, but you'll have to test it to see how it plays out.

Normally, delay is not a good choice because while you're delaying, you can't do anything else. If you want your arduino to react quickly to some other event later, you'll need to redo your code to remove the delays.

wildbill:
Possibly, hard to say without a better understanding of your setup. Delay is what I was going to suggest, but you'll have to test it to see how it plays out.

Normally, delay is not a good choice because while you're delaying, you can't do anything else. If you want your arduino to react quickly to some other event later, you'll need to redo your code to remove the delays.

what is the best way to keep an output HIGH while the rest goes on ?

what is the best way to keep an output HIGH while the rest goes on ?

Use millis() for timing. See Several things at the same time

UKHeliBob:
Use millis() for timing. See Several things at the same time

I think I will keep using delay ...

the cycles of this liquid extractor might have different length, so it would have to record time.

this is a really simple machine ....

the only other things I'd want it to do would be to record how many cycles and some parameters at each cycle ...

can I write this to the eprom ?

if so how?

how can I know how many cycles per day?

looks like I might have to use millis?

T

tobielepine:
sorry guys, I have absolutely no programming experience.

Maybe reading C - Flow Control Statements willl help with the specific part about the 'if' construction :wink: There are more, this is just the first one I found while searching for C control structures

tobielepine:
I think I will keep using delay ...

So what happens in your code if during a delay the tanks get full. I understand that that might not be likely but in coding 20% of the code goes into the actual implementation and 80% into hardening it to prevent disasters, validating user input (not applicable in this case).

Further your code contains the following

  //A99
  if ((digitalRead(A51FLOAT_SWITCH_PIN) == HIGH) &&
      (digitalRead(A99FLOAT_SWITCH_PIN) == HIGH) &&
      (digitalRead(B51FLOAT_SWITCH_PIN) == LOW) &&
      (digitalRead(B99FLOAT_SWITCH_PIN) == LOW))
  {
    digitalWrite(Valve_1_PIN, LOW); //open vacuum to A
    digitalWrite(Valve_2_PIN, HIGH); //open vacuum to B
    digitalWrite(Valve_3_PIN, HIGH); //purge A
    ...
    ...
  }

  //B51
  if ((digitalRead(A51FLOAT_SWITCH_PIN) == LOW) &&
      (digitalRead(A99FLOAT_SWITCH_PIN) == LOW) &&
      (digitalRead(B51FLOAT_SWITCH_PIN) == HIGH) &&
      (digitalRead(B99FLOAT_SWITCH_PIN) == LOW))
  {
    digitalWrite(Valve_1_PIN, HIGH); //open vacuum to A
    digitalWrite(Valve_2_PIN, HIGH); //open vacuum to B
    digitalWrite(Valve_3_PIN, LOW); //purge A
    ...
    ...
  }

Either the comments don't make sense or the code is wrong or I'm missing something :wink:
In the first part, writing Valve_1_PIN low opens the vacuum, in the second part writing it high opens it?

Assuming that I'm not missing something (it's probably a copy/paste mistake), it's difficult to follow if your comments don't match the code.

Is there going to be any sort of user control of this machine? Because, like they are hinting above, this path (with the delay(); ) may lead you into some trouble.

-jim lee