[aide] communication serie

bonjour .
encore moi! :blush:
je viens d'essaye de suivre un tuto en anglaishttp://jhaskellsblog.blogspot.fr/2011/05/serial-comm-fundamentals-on-arduino.html pour capturer une trame complète c'est à dire:
on regarde pour un starchar et un endchar .

voici le code:

//buffer size for NMEA compliant GPS string

#define DATABUFFERSIZE      1024
char dataBuffer[DATABUFFERSIZE+1]; //Add 1 for NULL terminator
byte dataBufferIndex = 0;

void setup(){
  Serial.begin(57600);
  Serial2.begin(57600);
  Serial.print("wait data on com2");
}
//******************************************//

boolean getSerialString(){
char startChar = '

le

boolean getSerialString(){

ça se place bien après le void setup()? c'est un peut comme une "sorte de macro" , non?; // or '!', or whatever your start character is
char endChar = '\x1a';
boolean storeString = false; //This will be our flag to put the data in our buffer
static byte dataBufferIndex = 0;
while(Serial2.available()>0)
{
  char incomingbyte = Serial2.read();
      Serial.print(incomingbyte);// teste
  if(incomingbyte==startChar)
  {
  dataBufferIndex = 0;  //Initialize our dataBufferIndex variable
  storeString = true;
  }
  if(storeString)
  {
    //Let's check our index here, and abort if we're outside our buffer size
    //We use our define here so our buffer size can be easily modified
    if(dataBufferIndex==DATABUFFERSIZE)
    {
    //Oops, our index is pointing to an array element outside our buffer.
    dataBufferIndex = 0;
    break;
    }
if(incomingbyte==endChar)
{
  dataBuffer[dataBufferIndex] = 0; //null terminate the C string
  //Our data string is complete.  return true
  return true;
  }
  else{
    dataBuffer[dataBufferIndex++] = incomingbyte;
    dataBuffer[dataBufferIndex] = 0; //null terminate the C string
}}
  else{
}}
  //We've read in all the available Serial data, and don't have a valid string yet, so return false
  return false;
}
//************************/////
void loop(){
 
  if(getSerialString()){
    //String available for parsing.  Parse it here
    Serial.print(dataBuffer);

}

}


le 

> boolean getSerialString(){

ça se place bien après le void setup()? c'est un peut comme une "sorte de macro" , non?

PUB : et pourquoi ne pas aller voir un tuto en français : [Tuto] Implémenter un protocole de communication
XD

alors ça ! ça m'intéresse pour la 2° partie de mon projet qui serra l'utilisation du com1 pour inter-agire avec la chaudière.
mais j'ai pas encore déchiffré la doc en allemand. :blush: