any ideas?

hi there i have written this sketch which seems to work how i want it to apart from one thing where i have written at this point where it should bring on the lock out LED it doesnt seem to any ideas?

const int heatbutton = 2;
const int ventbutton = 3;
const int ignition = 4;
const int saleswitch = 5;
const int solenoid = 6;
const int photo_pressure = 7;
const int lockoutled = 13;
const int resetbutton = 9;
const int fan = 10;
const int map1_or2 = 11;

void setup()
{
  pinMode(heatbutton, INPUT);    
  pinMode(ventbutton, INPUT);
  pinMode(ignition, OUTPUT);
  pinMode(saleswitch, INPUT);
  pinMode(photo_pressure, INPUT);
  pinMode(lockoutled, OUTPUT);
  pinMode(resetbutton, OUTPUT);
  pinMode(fan, OUTPUT);
  pinMode(map1_or2, INPUT);
  }
  
  void loop(){                              
  if (digitalRead(ventbutton)==HIGH) {                       // vent button
        digitalWrite(fan, HIGH); }
        else {
          digitalWrite(fan, LOW); }
          
if (digitalRead(heatbutton)==LOW) {
  if (digitalRead(photo_pressure)==LOW) {                  //    low gas pressure
   digitalWrite(lockoutled, HIGH);                         // when heat button is LOW
   digitalWrite(solenoid, LOW); }
  while (digitalRead(resetbutton)==HIGH) {
  digitalWrite(lockoutled, LOW); 
  return; } }
   
  
  if (digitalRead(heatbutton)==HIGH) {                    // Heat button
  digitalWrite(fan, HIGH);
  delay(2500);
  if (digitalRead(saleswitch)==HIGH) {                  // sale switch if HIGH
  digitalWrite(solenoid, HIGH); }
  else {                                                // sale switch if LOW
   digitalWrite(lockoutled, HIGH);     //at this point 
   digitalWrite(solenoid, LOW);
   digitalWrite(fan, LOW); 
  while (digitalRead(resetbutton)!=HIGH) {
  digitalWrite(lockoutled, LOW); }
  return; }
      delay(3000); 
    if (digitalRead(photo_pressure)==LOW) {            // pressure if LOW
   digitalWrite(solenoid, LOW);
   digitalWrite(fan, LOW);
   digitalWrite(lockoutled, HIGH);     // at this point
   while (digitalRead(resetbutton)!=HIGH) {      
   digitalWrite(lockoutled, LOW); } }
  }
      else {                                          // switching off
        digitalWrite(solenoid, LOW);
        delay(1000);
        digitalWrite(fan, LOW); }
 }

Maybe you should explain the prupose of the sketch, what you expect for output and what you got ?

Maybe you should put each { and } on it's own line, and use the Tools + Auto format option to make the code readable.

Actually, there's no maybe about it.

when i have written //at this point it sould make the lockoutled HIGH but it does now tho?

A // is a comment; it can't make anything execute.

sorry when i say //at this point i was referring to that line on the sketch i posted

There are several comments in the code you posted. Please, format the code. My eyes hurt looking at it.

else {         
   digitalWrite(lockoutled, HIGH);     //at this point 
   digitalWrite(solenoid, LOW);
   digitalWrite(fan, LOW); 
  while (digitalRead(resetbutton)!=HIGH) {
  digitalWrite(lockoutled, LOW); }
  return; }

and the other

if (digitalRead(photo_pressure)==LOW) {            // pressure if LOW
   digitalWrite(solenoid, LOW);
   digitalWrite(fan, LOW);
   digitalWrite(lockoutled, HIGH);     // at this point
   while (digitalRead(resetbutton)!=HIGH) {      
   digitalWrite(lockoutled, LOW); } }

any ideas?

try reading the replies already made then follow the advice

Try putting a delay(2000); after this: digitalWrite(lockoutled, HIGH);

Should prove enlightening.

hi i have put the delay in and that works but only for the time of the delay what is no good and i have played with this { and } could not get it any beter

What if resetbutton was changed to pinMode INPUT?

sorry could you give me an example thanks

could you give me an example

OK. Not like this: pinMode(resetbutton, OUTPUT);

EDIT: Sorry, tags got tangled.

Not like this: code]pinMode(resetbutton, OUTPUT);

what is that meant to mean??

i put it in the loop and now the fan does not turn off aswell as the original problem

what is that meant to mean??

Sorry, my tags got tangled.

I assumed that if you were reading "resetbutton", you'd want to make it an input, not an output.

o ok
still not working now it flashes between the fan and the lockoutled

this is seding me around the bend now lol

const int heatbutton     = 2;
const int ventbutton     = 3;
const int ignition       = 4;
const int saleswitch     = 5;
const int solenoid       = 6;
const int photo_pressure = 7;
const int lockoutled     = 13;
const int resetbutton    = 9;
const int fan            = 10;
const int map1_or2       = 11;

void setup()
{
  pinMode(heatbutton,     INPUT);    
  pinMode(ventbutton,     INPUT);
  pinMode(saleswitch,     INPUT);
  pinMode(photo_pressure, INPUT);
  pinMode(map1_or2,       INPUT);
  pinMode(resetbutton,    INPUT);             // Added by jameshappy
  pinMode(ignition,       OUTPUT);
  pinMode(lockoutled,     OUTPUT);
  pinMode(fan,            OUTPUT);
  pinMode(solenoid,       OUTPUT);            // Added by jameshappy
  //pinMode(resetbutton,  OUTPUT);            // Commented by jameshappy
}

void loop(){                              
  if (digitalRead(ventbutton) == HIGH) {      // vent button
    digitalWrite(fan, HIGH); 
  }
  else {
    digitalWrite(fan, LOW); 
  }

  if (digitalRead(heatbutton) == LOW) {
    if (digitalRead(photo_pressure) == LOW) { // low gas pressure
      digitalWrite(lockoutled, HIGH);         // when heat button is LOW
      digitalWrite(solenoid, LOW); 
    }
    while (digitalRead(resetbutton) == HIGH) {
      digitalWrite(lockoutled, LOW); 
      return; 
    } 
  }

  if (digitalRead(heatbutton) == HIGH) {      // Heat button
    digitalWrite(fan, HIGH);
    delay(2500);
    if (digitalRead(saleswitch) == HIGH) {    // sale switch if HIGH
      digitalWrite(solenoid, HIGH); 
    }
    else {                                    // sale switch if LOW
      // Turn on lockoutled
      digitalWrite(lockoutled, HIGH);         //at this point 
      // Turn off solenoid
      digitalWrite(solenoid, LOW);
      // Turn off fan
      digitalWrite(fan, LOW); 
      // Turn off lockoutled while the resetbutton is not being pressed
      while (digitalRead(resetbutton) != HIGH) {
        digitalWrite(lockoutled, LOW); 
      }
      return; 
    }
    delay(3000); 
    if (digitalRead(photo_pressure) == LOW) { // pressure if LOW
      // Turn off solenoid
      digitalWrite(solenoid, LOW);
      // Turn off fan
      digitalWrite(fan, LOW);
      // Turn on lockoutled
      digitalWrite(lockoutled, HIGH);         // at this point
      // Turn off lockoutled while the resetbutton is not being pressed
      while (digitalRead(resetbutton) != HIGH) {      
        digitalWrite(lockoutled, LOW); 
      } 
    }
  }
  else {                                      // switching off
    digitalWrite(solenoid, LOW);
    delay(1000);
    digitalWrite(fan, LOW); 
  }
}

I think this is what you need:

// Turn on lockoutled
digitalWrite(lockoutled, HIGH);

// Turn off solenoid
digitalWrite(solenoid, LOW);

// Turn off fan
digitalWrite(fan, LOW); 

// Wait for opperator to clear fault
while (digitalRead(resetbutton) != HIGH) {
  delayMicroseconds(1); // Optional
}

// Turn off lockoutled
digitalWrite(lockoutled, LOW);