Thanks guys, yes i dont have my terminology right. At the mometn i have:
const byte bIn1=5;
const byte HEATER=12;
const byte MOTOR=13;
void setup()
{
pinMode(bIn1,INPUT);
pinMode(HEATER,OUTPUT);
pinMode(MOTOR,OUTPUT);
}
void loop()
{
if (digitalRead(bIn1)==LOW)
{ digitalWrite(MOTOR,HIGH);
digitalWrite(HEATER,HIGH);
delay(5000);
digitalWrite(12,LOW);
delay(5000);}
else { digitalWrite(MOTOR,LOW);
digitalWrite(HEATER,LOW);};
;
}
It does what i want it to with the switch being on a door so it stays on (lid closed ) and off (lid open), the only issue i have is that i want the motor and heater to stop immediately when i open the lid but it waits until the delay is finished and then stops. How can i get it to stop immediately?