int LED1 = 13;
int LED2 = 12;
int LED3 = 11;
int IR1 = 2;
int IR2 = 3;
int IR3 = 4;
int val1 = 0;
int val2 = 0;
int val3 = 0;
void setup() {
pinMode(IR1, INPUT);
pinMode(IR2, INPUT);
pinMode(IR3, INPUT);
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
Serial.begin(9600);
}
void loop() {
val1 = digitalRead(IR1);
val2 = digitalRead(IR2);
val3 = digitalRead(IR3);
if (val1 == 0) {
digitalWrite(LED1, HIGH);
}
else {
digitalWrite(LED1, LOW);
}
if (val2 == 0) {
digitalWrite(LED2, HIGH);
}
else {
digitalWrite(LED2, LOW);
}
if (val3 == 0) {
digitalWrite(LED3, HIGH);
}
else {
digitalWrite(LED3, LOW);
}
delay(200);
}