void setup() {
// initialize serial communication:
Serial.begin(9600);
Serial.println("Mohamed Geasa");
// initialize the LED pins:
for (int thisPin = 2; thisPin < 7; thisPin++) {
pinMode(thisPin, OUTPUT);
}
}
void loop() {
if (Serial.available() > 0) {
int inByte = Serial.read();
switch (inByte) {
case 'a':
digitalWrite(2, HIGH);
break;
case 'b':
digitalWrite(3, HIGH);
break;
case 'c':
digitalWrite(4, HIGH);
break;
case 'd':
digitalWrite(5, HIGH);
break;
case 'e':
digitalWrite(6, HIGH);
break;
case 'off':
for (int thisPin = 2; thisPin < 7; thisPin++) {
digitalWrite(thisPin, LOW);
}
default:
// turn all the LEDs off:
for (int thisPin = 2; thisPin < 7; thisPin++) {
// digitalWrite(thisPin, LOW);
}
}
}
}