Programming Examples
Arduino Program to take input from serial and on the led based on input.
Arduino Program which accept the (R,G,Y) from Serial Input and On the Light Based on Given Input
void setup()
{
 Serial.begin(9600);
 pinMode(13,OUTPUT);
 pinMode(12,OUTPUT);
 pinMode(11,OUTPUT);
}
void loop()
{
char ch;
 if(Serial.available())
 {
 ch=Serial.read();
 Serial.print(ch);
  if(ch=='r'||ch=='R')
  {
   digitalWrite(13,HIGH);
   digitalWrite(12,LOW);
   digitalWrite(11,LOW);
  }
  else if(ch=='g'||ch=='G')
  {
   digitalWrite(13,LOW);
   digitalWrite(12,HIGH);
   digitalWrite(11,LOW);
  }
  else if(ch=='y' ||ch=='Y' )
  {
   digitalWrite(13,LOW);
   digitalWrite(12,LOW);
   digitalWrite(11,HIGH);
  }
 }
}
Output