Oh crap. Your right. ![]()
How do i separate them?
How do i change from buttons to relays?
Thanks for telling me all of this, i didnt even see it...
Relay 1 has to be connected to detector 1. And Relay 2 has to be to detector 2.
So that it does not sprinkle the wrong area.![]()
Can i put in if/else detector 1 HIGH or something?
Any geniuses out there? ![]()
Does this work?
const int buttonPin = 2;Â Â // smokedetector 1
const int buttonPin2 = 3;Â Â // smokedetector 2
const int ledPin =Â 10;Â Â Â // relay1
const int ledPin2 =Â 11;Â Â // relay2
// variables will change:
int buttonState = 0;Â Â Â
void setup() {
 // initialize relay 1 pin as an output:
 pinMode(ledPin, OUTPUT);  Â
 // initialize relay 2 pin as an output:
 pinMode(ledPin2, OUTPUT); Â
 // initialize the smokedetector 1 pin as an input:
 pinMode(buttonPin, INPUT); Â
 // initialize the smokedetector 2 pin as an input:
 pinMode(buttonPin2, INPUT); Â
}
void loop(){
 // read the state of the pushbutton value:
 buttonState = digitalRead(buttonPin);
 button2State = digitalRead(buttonPin2);
 // check if the pushbutton is pressed.
 // if it is, the buttonState is HIGH:
 if (buttonState == HIGH) { Â
  // turn relays on: Â
  digitalWrite(ledPin, LOW);Â
 }
 else {
  // turn relays off:
  digitalWrite(ledPin, HIGH);
 }
Â
 // check if the pushbutton is pressed.
 // if it is, the buttonState is HIGH:
 if (button2State == HIGH) { Â
  // turn relays on: Â
  digitalWrite(ledPin2, LOW);Â
 }
 else {
  // turn relays off:
  digitalWrite(ledPin2, HIGH);
 }
}