const int ledPins[] = {2, 3, 4, 5, 6, 7};
void setup() {
for (int i = 0; i < 6; i++) {
pinMode(ledPins[i], OUTPUT);
digitalWrite(ledPins[i], LOW);
}
Serial.begin(9600); // Start serial communication at 9600 bps
}
void loop() {
if (Serial.available() > 0) {
int value = Serial.parseInt(); // Read the integer value
// Turn on the corresponding LED
for (int i = 0; i < 6; i++) {
if (value == ledPins[i] + 180) {
digitalWrite(ledPins[i], HIGH);
} else {
digitalWrite(ledPins[i], LOW);
}
}
}
}