const int PinLEDR = 11;
const int PinLEDB = 10;
const int PinLEDV = 9;

const char LedR = 'R';
const char LedV = 'V';
const char LedB = 'B';
const char Off = '0';
char c=' ';

void setup() {
  Serial.begin(9600);
  pinMode (PinLEDR, OUTPUT);
  pinMode (PinLEDB, OUTPUT);
  pinMode (PinLEDV, OUTPUT);
  Serial.println ("Pour allumer la DEL rouge, envoyer: R");
  Serial.println ("Pour allumer la DEL verte, envoyer: V");
  Serial.println ("Pour allumer la DEL bleue, envoyer: B");
  Serial.println ("Pour eteindre les DELs, envoyer: 0");
}

void loop() {
  if (Serial.available() > 0) {
  c = Serial.read();
  }
  
  if (c == LedR) {
    Serial.println (c);
    digitalWrite(PinLEDR,1);
    digitalWrite(PinLEDV,0);
    digitalWrite(PinLEDB,0);
    }
  if (c == LedV) {
    Serial.println (c);
    digitalWrite(PinLEDR,0);
    digitalWrite(PinLEDV,1);
    digitalWrite(PinLEDB,0);
    }
  if (c == LedB) {
    Serial.println (c);
    digitalWrite(PinLEDR,0);
    digitalWrite(PinLEDV,0);
    digitalWrite(PinLEDB,1);
  }
  if (c == Off) {
    Serial.println (c);
    digitalWrite(PinLEDR,0);
    digitalWrite(PinLEDV,0);
    digitalWrite(PinLEDB,0);
  }
  Serial.flush();
  c=' ';
}
