user10557: I'm trying to read either high or low from a pressure switch, I do have a pulldown resistor attached but even if I plug in a wire with nothing on it i get a false high. I've changed pins, tried adding INPUT_PULLUP to the program but it it reads false.
The code i'm using is: 
const int mainPump = 2;
const int prePump = 3;
const int idleValve = 4;
const int chemTankLow = 5;
const int chemTankHigh = 6;
int pressure = 8; //7 originally removed const
const int chemValve = A7;
const int mem2 = A6;
const int mem3 = A5;
const int mem4 = A4;
const int mem5 = A3;
int tankLow = 0;
int tankHigh = 0;
int pressureFault = 0;
int lpe = 0;
int maxlpe = 2;
unsigned long timer[10]; //number of timers needed
byte timerState[10]; //store timers
int goNoGo = 0;
int readVoltage = 0;
int var = 0;



void setup() {

  pinMode(idleValve, OUTPUT);
  pinMode(prePump, OUTPUT);
  pinMode(mainPump, OUTPUT);
  digitalWrite(mainPump, HIGH);
  pinMode(pressure, INPUT);   //removed _PULLUP after input
  pinMode(chemTankLow, INPUT);
  pinMode(chemTankHigh, INPUT);
  pinMode(chemValve, OUTPUT);
  pinMode(mem2, OUTPUT);
  pinMode(mem3, OUTPUT);
  pinMode(mem4, OUTPUT);
  pinMode(mem5, OUTPUT);


  digitalWrite(mem2, HIGH);
  digitalWrite(mem3, HIGH);
  digitalWrite(mem4, HIGH);
  digitalWrite(mem5, HIGH);
  digitalWrite(chemValve, HIGH);
  digitalWrite(idleValve, HIGH);
  digitalWrite(prePump, HIGH);
  digitalWrite(prePump, HIGH);
  digitalWrite(idleValve, HIGH);
}
void loop()
{

       tankLow = digitalRead(5);
   tankHigh = digitalRead(6);

  if (tankLow == LOW && tankHigh == LOW){ //start day tank refill
   digitalWrite(A7, LOW);
  }
  if (tankLow == HIGH && tankHigh == HIGH){
    digitalWrite(A7, HIGH);
  }
  static int state = 1; // initial state is 1, the "idle" state.
  static unsigned long ts;

  switch (state)
  {
    case 1:
    ts = millis();

  if (delayMilliSeconds(1, 6000)){//600000

  digitalWrite(prePump, LOW);

  goNoGo = digitalRead(mainPump);
  if (goNoGo == LOW) {

    digitalWrite(idleValve, HIGH);
  }
    else {
      digitalWrite(idleValve, LOW);
          digitalWrite(mem2, LOW);
    digitalWrite(mem3, LOW);
    digitalWrite(mem4, LOW);
    digitalWrite(mem5, LOW);
    }

        readVoltage= digitalRead(idleValve);
    if(readVoltage==LOW){

    delay(4000); // wait time motors to stablize
    // read the input on analog pin 0:
    int sensorValue = analogRead(A0);
    // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
    float voltage = sensorValue * (4.83 / 1023.0);

    if (voltage >= 2.00) 
    {
      state = 2;
    } 


    else {
      delay(56000); //on time for test
    //  if (delayMilliSeconds(2, 51994)){
    digitalWrite(mem2, HIGH);
    digitalWrite(mem3, HIGH);
    digitalWrite(mem4, HIGH);
    digitalWrite(mem5, HIGH);

     digitalWrite(idleValve, HIGH);
      digitalWrite(prePump, HIGH);
      digitalWrite(mainPump, HIGH);
    }
    }

}
//} for if timer
break;

    case 2:
       ts = millis();
      digitalWrite(mainPump, LOW);
      digitalWrite(idleValve, HIGH);
       digitalWrite(mem2, HIGH);
        digitalWrite(mem3, HIGH);
        digitalWrite(mem4, HIGH);
        digitalWrite(mem5, HIGH);
        delay(20000);
        state = 3;

        break;


        case 3:

      digitalWrite(mainPump, LOW);
      digitalWrite(idleValve, HIGH);
       digitalWrite(mem2, HIGH);
        digitalWrite(mem3, HIGH);
        digitalWrite(mem4, HIGH);
        digitalWrite(mem5, HIGH);

      pressureFault = digitalRead(pressure);
  if (pressureFault == HIGH){ 

    state = 4; 
  } 
   if (millis() - ts > 3600000){
    state = 5;
  }



   break;

   case 4:
   digitalWrite(mainPump, HIGH);
   digitalWrite(prePump, LOW);
   digitalWrite(idleValve, LOW);
      digitalWrite(mem2, LOW);
    digitalWrite(mem3, LOW);
    digitalWrite(mem4, LOW);
    digitalWrite(mem5, LOW);
    delay(3000);
    digitalWrite(mainPump, HIGH);
   digitalWrite(prePump, HIGH);
   digitalWrite(idleValve, HIGH);
      digitalWrite(mem2, HIGH);
    digitalWrite(mem3, HIGH);
    digitalWrite(mem4, HIGH);
    digitalWrite(mem5, HIGH);
    delay(600); //60000
    state = 1;

    break;

    case 5:
    ts = millis();
        digitalWrite(idleValve,LOW);
        digitalWrite(prePump,LOW);
         digitalWrite(mainPump, HIGH);
           delay(60000); //60000 for standard
           digitalWrite(mem2, LOW);
           delay(60000);
           digitalWrite(mem2, HIGH);
           digitalWrite(mem3, LOW);
           delay(60000);
           digitalWrite(mem3, HIGH);
           digitalWrite(mem4, LOW);
           delay(60000);
           digitalWrite(mem4, HIGH);
           digitalWrite(mem5, LOW);
           delay(60000);
           digitalWrite(mem5, HIGH);

           delay(1000);   // leave this time
         digitalWrite(idleValve, HIGH);
         digitalWrite(mainPump, LOW);
       state = 2;
         break;
         default:

         state = 1; 

         break;


  } //switch
} //loop




int delayMilliSeconds(int timerNumber,unsigned long delaytime){
  unsigned long timeTaken;
  if (timerState[timerNumber]==0){    //If the timer has been reset (which means timer (state ==0) then save millis() to the same number timer, 
    timer[timerNumber]=millis();
    timerState[timerNumber]=1;      //now we want mark this timer "not reset" so that next time through it doesn't get changed.
  }
  if (millis()> timer[timerNumber]){
    timeTaken=millis()+1-timer[timerNumber];    //here we see how much time has passed
  }
  else{
    timeTaken=millis()+2+(4294967295-timer[timerNumber]);    //if the timer rolled over (more than 48 days passed)then this line accounts for that
  }
  if (timeTaken>=delaytime) {          //here we make it easy to wrap the code we want to time in an "IF" statement, if not then it isn't and so doesn't get run.
     timerState[timerNumber]=0;  //once enough time has passed the timer is marked reset.
     return 1;                          //if enough time has passed the "IF" statement is true
  }
  else {                               //if enough time has not passed then the "if" statement will not be true.
    return 0;
  }

}

As for wiring it is as basic as it gets 3.3v pin off the arduino to a pressure switch and then back to the arduino . but i'm not even making it to the switch before i have an issue literally plug in a 3ft wire not connected to anything and it goes to case 4
I've tried setting the code up to go to case 4 if it detects a LOW but hasn't changed my issue.

user10807: As a hint.  Start by removing the stuff you added an just try to detect a grounding of your input pin (I'm assuming digitalRead(pressure) is the standard read the digital value of a pin and not some funky function you've written)
Use some code like this to test your hard ware
int    pressure;   

void setup()
{
    Serial.begin(9600);  //Start a serial monitor to see the results
    pressure = 4;  // Assumes your pressure input is pin 4 
                   // change if need be
    pinMode(pressure,INPUT_PULLUP);  //Sets put to input with pullup
    digitalWrite(pressure,HIGH);      //Activates pullup
}

void loop()
{
     if (digitalRead(pressure))
     {
          Serial.println("Pin is High");
     }
     else
     {
          Serial.println("Pin is low");
     }
     delay(1000);
  }

Now compile, upload and activate the serial monitor.  Every second you will get the read of the pin on the monitor.  See if grounding the pin is detected.  If not, you may have popped the port.
BTW.  3 ft of wire will need some filtering and protection.  That will pick up a lot of noise.
Cheers

10557: <p>I'm trying to read either high or low from a pressure switch, I do have a pulldown resistor attached but even if I plug in a wire with nothing on it i get a false high. I've changed pins, tried adding <code>INPUT_PULLUP</code> to the program but it it reads false.</p>

<p>The code i'm using is: </p>

<pre><code>const int mainPump = 2;
const int prePump = 3;
const int idleValve = 4;
const int chemTankLow = 5;
const int chemTankHigh = 6;
int pressure = 8; //7 originally removed const
const int chemValve = A7;
const int mem2 = A6;
const int mem3 = A5;
const int mem4 = A4;
const int mem5 = A3;
int tankLow = 0;
int tankHigh = 0;
int pressureFault = 0;
int lpe = 0;
int maxlpe = 2;
unsigned long timer[10]; //number of timers needed
byte timerState[10]; //store timers
int goNoGo = 0;
int readVoltage = 0;
int var = 0;



void setup() {

  pinMode(idleValve, OUTPUT);
  pinMode(prePump, OUTPUT);
  pinMode(mainPump, OUTPUT);
  digitalWrite(mainPump, HIGH);
  pinMode(pressure, INPUT);   //removed _PULLUP after input
  pinMode(chemTankLow, INPUT);
  pinMode(chemTankHigh, INPUT);
  pinMode(chemValve, OUTPUT);
  pinMode(mem2, OUTPUT);
  pinMode(mem3, OUTPUT);
  pinMode(mem4, OUTPUT);
  pinMode(mem5, OUTPUT);


  digitalWrite(mem2, HIGH);
  digitalWrite(mem3, HIGH);
  digitalWrite(mem4, HIGH);
  digitalWrite(mem5, HIGH);
  digitalWrite(chemValve, HIGH);
  digitalWrite(idleValve, HIGH);
  digitalWrite(prePump, HIGH);
  digitalWrite(prePump, HIGH);
  digitalWrite(idleValve, HIGH);
}
void loop()
{

       tankLow = digitalRead(5);
   tankHigh = digitalRead(6);

  if (tankLow == LOW &amp;&amp; tankHigh == LOW){ //start day tank refill
   digitalWrite(A7, LOW);
  }
  if (tankLow == HIGH &amp;&amp; tankHigh == HIGH){
    digitalWrite(A7, HIGH);
  }
  static int state = 1; // initial state is 1, the "idle" state.
  static unsigned long ts;

  switch (state)
  {
    case 1:
    ts = millis();

  if (delayMilliSeconds(1, 6000)){//600000

  digitalWrite(prePump, LOW);

  goNoGo = digitalRead(mainPump);
  if (goNoGo == LOW) {

    digitalWrite(idleValve, HIGH);
  }
    else {
      digitalWrite(idleValve, LOW);
          digitalWrite(mem2, LOW);
    digitalWrite(mem3, LOW);
    digitalWrite(mem4, LOW);
    digitalWrite(mem5, LOW);
    }

        readVoltage= digitalRead(idleValve);
    if(readVoltage==LOW){

    delay(4000); // wait time motors to stablize
    // read the input on analog pin 0:
    int sensorValue = analogRead(A0);
    // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
    float voltage = sensorValue * (4.83 / 1023.0);

    if (voltage &gt;= 2.00) 
    {
      state = 2;
    } 


    else {
      delay(56000); //on time for test
    //  if (delayMilliSeconds(2, 51994)){
    digitalWrite(mem2, HIGH);
    digitalWrite(mem3, HIGH);
    digitalWrite(mem4, HIGH);
    digitalWrite(mem5, HIGH);

     digitalWrite(idleValve, HIGH);
      digitalWrite(prePump, HIGH);
      digitalWrite(mainPump, HIGH);
    }
    }

}
//} for if timer
break;

    case 2:
       ts = millis();
      digitalWrite(mainPump, LOW);
      digitalWrite(idleValve, HIGH);
       digitalWrite(mem2, HIGH);
        digitalWrite(mem3, HIGH);
        digitalWrite(mem4, HIGH);
        digitalWrite(mem5, HIGH);
        delay(20000);
        state = 3;

        break;


        case 3:

      digitalWrite(mainPump, LOW);
      digitalWrite(idleValve, HIGH);
       digitalWrite(mem2, HIGH);
        digitalWrite(mem3, HIGH);
        digitalWrite(mem4, HIGH);
        digitalWrite(mem5, HIGH);

      pressureFault = digitalRead(pressure);
  if (pressureFault == HIGH){ 

    state = 4; 
  } 
   if (millis() - ts &gt; 3600000){
    state = 5;
  }



   break;

   case 4:
   digitalWrite(mainPump, HIGH);
   digitalWrite(prePump, LOW);
   digitalWrite(idleValve, LOW);
      digitalWrite(mem2, LOW);
    digitalWrite(mem3, LOW);
    digitalWrite(mem4, LOW);
    digitalWrite(mem5, LOW);
    delay(3000);
    digitalWrite(mainPump, HIGH);
   digitalWrite(prePump, HIGH);
   digitalWrite(idleValve, HIGH);
      digitalWrite(mem2, HIGH);
    digitalWrite(mem3, HIGH);
    digitalWrite(mem4, HIGH);
    digitalWrite(mem5, HIGH);
    delay(600); //60000
    state = 1;

    break;

    case 5:
    ts = millis();
        digitalWrite(idleValve,LOW);
        digitalWrite(prePump,LOW);
         digitalWrite(mainPump, HIGH);
           delay(60000); //60000 for standard
           digitalWrite(mem2, LOW);
           delay(60000);
           digitalWrite(mem2, HIGH);
           digitalWrite(mem3, LOW);
           delay(60000);
           digitalWrite(mem3, HIGH);
           digitalWrite(mem4, LOW);
           delay(60000);
           digitalWrite(mem4, HIGH);
           digitalWrite(mem5, LOW);
           delay(60000);
           digitalWrite(mem5, HIGH);

           delay(1000);   // leave this time
         digitalWrite(idleValve, HIGH);
         digitalWrite(mainPump, LOW);
       state = 2;
         break;
         default:

         state = 1; 

         break;


  } //switch
} //loop




int delayMilliSeconds(int timerNumber,unsigned long delaytime){
  unsigned long timeTaken;
  if (timerState[timerNumber]==0){    //If the timer has been reset (which means timer (state ==0) then save millis() to the same number timer, 
    timer[timerNumber]=millis();
    timerState[timerNumber]=1;      //now we want mark this timer "not reset" so that next time through it doesn't get changed.
  }
  if (millis()&gt; timer[timerNumber]){
    timeTaken=millis()+1-timer[timerNumber];    //here we see how much time has passed
  }
  else{
    timeTaken=millis()+2+(4294967295-timer[timerNumber]);    //if the timer rolled over (more than 48 days passed)then this line accounts for that
  }
  if (timeTaken&gt;=delaytime) {          //here we make it easy to wrap the code we want to time in an "IF" statement, if not then it isn't and so doesn't get run.
     timerState[timerNumber]=0;  //once enough time has passed the timer is marked reset.
     return 1;                          //if enough time has passed the "IF" statement is true
  }
  else {                               //if enough time has not passed then the "if" statement will not be true.
    return 0;
  }

}
</code></pre>

<p>As for wiring it is as basic as it gets 3.3v pin off the arduino to a pressure switch and then back to the arduino . but i'm not even making it to the switch before i have an issue literally plug in a 3ft wire not connected to anything and it goes to case 4
I've tried setting the code up to go to case 4 if it detects a LOW but hasn't changed my issue.</p>
 10807: <p>As a hint.  Start by removing the stuff you added an just try to detect a grounding of your input pin (I'm assuming digitalRead(pressure) is the standard read the digital value of a pin and not some funky function you've written)</p>

<p>Use some code like this to test your hard ware</p>

<pre><code>int    pressure;   

void setup()
{
    Serial.begin(9600);  //Start a serial monitor to see the results
    pressure = 4;  // Assumes your pressure input is pin 4 
                   // change if need be
    pinMode(pressure,INPUT_PULLUP);  //Sets put to input with pullup
    digitalWrite(pressure,HIGH);      //Activates pullup
}

void loop()
{
     if (digitalRead(pressure))
     {
          Serial.println("Pin is High");
     }
     else
     {
          Serial.println("Pin is low");
     }
     delay(1000);
  }
</code></pre>

<p>Now compile, upload and activate the serial monitor.  Every second you will get the read of the pin on the monitor.  See if grounding the pin is detected.  If not, you may have popped the port.</p>

<p>BTW.  3 ft of wire will need some filtering and protection.  That will pick up a lot of noise.</p>

<p>Cheers</p>
