int RED = 9; int GREEN = 10; int BLUE = 11; void setup() { pinMode(RED, OUTPUT); pinMode(GREEN, OUTPUT); pinMode(BLUE, OUTPUT); Serial.begin(9600); } void loop() { if (Serial.available()) { char val = Serial.read(); Serial.println(val); if (val == 'r') { digitalWrite(RED, HIGH); Serial.println("red"); } if (val == 'b') { digitalWrite(BLUE, HIGH ); Serial.println("blue"); } if (val == 'g') { digitalWrite(GREEN, HIGH); Serial.println("green"); } if (val == 'a') { digitalWrite(RED, HIGH); digitalWrite(BLUE, HIGH ); digitalWrite(GREEN, HIGH); } if (val == 'o') { digitalWrite(RED, LOW); digitalWrite(BLUE, LOW ); digitalWrite(GREEN, LOW); } } }