
sbit LED1 = P3^4;    //LED on board
sbit SW1 = P1^7;     //Switch to begin the movement of actuator
sbit FValve = P3^5;  //Valve opened to begin movement of the actuator via CO2
sbit FSensor = P1^6; //Sensor at position actuator should not move past

if (SW1==0) // has been pressed
{
  while (FSensor==1) //FSensor is the sensor at the position 
                     //i want to stop the actuator moving past
  {
  LED1=1;            //turn on LED
  FValve=0;          //turn on valve
  } //end while

} // end if

else
{
LED1=0;              //turn off LED
FValve=1;            //turn off Valve
}

