#define ir_pin A2 #define pump 3 #define alarm 4 void setup() { pinMode(pump, OUTPUT); pinMode(alarm, OUTPUT); } void loop() { int ir = analogRead(ir_pin); if (ir > 400) { digitalWrite(pump, HIGH); digitalWrite(alarm, HIGH); } else { digitalWrite(pump, LOW); digitalWrite(alarm, LOW); } }