#define r 12
#define g 11
#define b 10
char ch;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(r, OUTPUT);
pinMode(g, OUTPUT);
pinMode(b, OUTPUT);
Serial.println("Press O or C:");
Serial.println("Press F or G:");
Serial.println("Press A or B:");
Serial.println("Press H or I:");
Serial.println("Press J or K:");
Serial.println("Press M or N:");
Serial.println("Press X or Y:");
}
void loop() {
// put your main code here, to run repeatedly:
if (Serial.available())
{
ch = Serial.read();
if (ch == 'O')
digitalWrite(r,1);
if (ch == 'C')
digitalWrite(r,0);
if (ch == 'F')
digitalWrite(g,1);
if (ch == 'G')
digitalWrite(g,0);
if (ch == 'A')
digitalWrite(b,1);
if (ch == 'B')
digitalWrite(b,0);
if (ch == 'H')
{
digitalWrite(r,1);
digitalWrite(g,1);
}
if (ch == 'I')
{
digitalWrite(r,0);
digitalWrite(g,0);
}
if (ch == 'J')
{
digitalWrite(r,1);
digitalWrite(b,1);
}
if (ch == 'K')
{
digitalWrite(r,0);
digitalWrite(b,0);
}
if (ch == 'M')
{
digitalWrite(g,1);
digitalWrite(b,1);
}
if (ch == 'N')
{
digitalWrite(b,0);
digitalWrite(g,0);
}
if (ch == 'X')
{
digitalWrite(r,1);
digitalWrite(g,1);
digitalWrite(b,1);
}
if (ch == 'Y')
{
digitalWrite(r,0);
digitalWrite(g,0);
digitalWrite(b,0);
}
}
}