#define red 12
#define green 11
#define blue 10
char ch;
void setup()
{
Serial.begin(9600);
pinMode(red, OUTPUT);
pinMode(green, OUTPUT);
pinMode(blue, OUTPUT);
Serial.println("press r /t g /t b /t y /t p /t t /t w /t c /t:");
}
void loop()
{
if (Serial.available())
{
ch=Serial.read();
if(ch=='r')
{
digitalWrite(red, 1);
digitalWrite(blue, 0);
digitalWrite(green, 0);
}
if(ch=='g')
{
digitalWrite(red,0);
digitalWrite(blue, 0);
digitalWrite(green, 1);
}
if(ch=='b')
{
digitalWrite(red,0);
digitalWrite(blue, 1);
digitalWrite(green,0 );
}
if(ch=='y')
{
digitalWrite(red,1);
digitalWrite(blue, 0);
digitalWrite(green,1 );
}
if(ch=='p')
{
digitalWrite(red,1);
digitalWrite(blue, 1);
digitalWrite(green,0 );
}
if(ch=='t')
{
digitalWrite(red,0);
digitalWrite(blue, 1);
digitalWrite(green, 1);
}
if(ch=='w')
{
digitalWrite(red,1);
digitalWrite(blue, 1);
digitalWrite(green,1 );
}
if(ch=='c')
{
digitalWrite(red,0);
digitalWrite(blue,0);
digitalWrite(green,0 );
}
}
}