/* DigitalReadSerial Reads a digital input on pin 2, prints the result to the serial monitor This example code is in the public domain. */ byte incomingBytes[3]; // for incoming serial data // the setup routine runs once when you press reset: void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); } // the loop routine runs over and over again forever: void loop() { // read the input pin: // print out the state of the button: /*Serial.write('H'); delay(1); // delay in between reads for stability*/ if (Serial.available() <= 3 && Serial.available() >= 1 ) { // read the incoming byte: Serial.readBytes(incomingBytes,3); // say what you got: /*Serial.print("I received: "); Serial.print(incomingBytes[0]); Serial.print(incomingBytes[1]); Serial.print(incomingBytes[2]); Serial.write(incomingBytes[0]); Serial.write(incomingBytes[1]); Serial.write(incomingBytes[2]);*/ //Serial.print(incomingBytes,3); Serial.write(incomingBytes,3); }/*else{ while(Serial.available()){Serial.read();} }*/ //while(Serial.available()){Serial.read();} //censé vider le buffer série }