int led_r = 6; int led_g = 9; int led_b = 11; char rgb; // Variable to store submitted command void setup() { pinMode(15,OUTPUT); // Set SysOn PIN as output digitalWrite(15,HIGH); // Set SysOn HIGH to power PCB pinMode(led_r,OUTPUT); // Set LED pins as output pinMode(led_g,OUTPUT); pinMode(led_b,OUTPUT); digitalWrite(led_r, HIGH); // turn off LEDs on start up digitalWrite(led_g, HIGH); digitalWrite(led_b, HIGH); Serial.begin(9600); // initialize serial connection with 9600 baud } void loop() { if (Serial.available()) { // check if data is available on the serial port rgb = Serial.read(); // read and store the data in the variable } if (rgb == '1') { digitalWrite(led_r, LOW); // red LED on } else if (rgb == '2') { digitalWrite(led_g, LOW); // green LED on } else if (rgb == '3') { digitalWrite(led_b, LOW); // blue LED on } else if (rgb == '4') { digitalWrite(led_r, LOW); // all 3 LEDs on digitalWrite(led_g, LOW); digitalWrite(led_b, LOW); } else if (rgb == '0') { digitalWrite(led_r, HIGH); // turn all LEDs off digitalWrite(led_g, HIGH); digitalWrite(led_b, HIGH); } delay(10); }