Byte concatenate real time

Hi guys,

I am using the 433 MHz receiver and transmitter with an arduino mega 2560 and UNO. Below is my code on the receivers end:

int incomingByte = 0;
int led = 13;

void setup() {

  Serial.begin(9600);
  pinMode(led, OUTPUT);
}


void loop() {

   if (Serial.available() > 0) {
           digitaWrite(led, HIGH);
           incomingByte = Serial.read();

           Serial.print(char(incomingByte));
           if (String(incomingByte))  == "00:00:00:00:00:00")  {
                  Serial.println("The data received does match");
                  }else{
                         Serial.println("The data received does not match");
                     }
        }
}

Now, every time I run this code, ' incomingByte' always stores just one byte ( one character)and therefore I always get the ' does not match ' error. I want to concatenate the bytes and store them in either a variable char or else a variable string. Can some body please help me here .

Thanks ,
Rochan

if (String(incomingByte))  == "00:00:00:00:00:00")

How could a single byte ever equal that string?
You need to read the incoming data into a string and then compare that, or compare one character at a time as they come in.

Heren is a function I wrote that basically does this

boolean waitPattern(char *receiveBuffer, int receiveBufferLen, char *thePattern,Stream *inStream)
{
char *patternPos = thePattern;

    receiveBufferLen--;// Allow space for zero termination
    
    while(*patternPos!=0 && receiveBufferLen>0)
    {
      if  (inStream->available() && receiveBufferLen-->0)
      {
        *receiveBuffer=inStream->read();
        if (*receiveBuffer++==*patternPos)
        {
          patternPos++;
        }
        else
        {
          patternPos = thePattern;// reset the pattern position pointer back to the start of the pattern
        }
      }
    }
    
    if (*patternPos==0)
    {
      *receiveBuffer=0;// terminate receive buffer
      return true; // found the pattern
    }
    else
    {
      return false;// did not find before we ran out of input buffer
    }
}

You pass a buffer, ie char array, a pattern ie a c string, and a pointer to stream ie &Serial

If you only want to pattern match, just modify the code to read into a single character rather than the pointer to the buffer.

Actually I have a version that works without a buffer, but is on a computer that I don't have access to until tomorrow, but some other clever person can change the code for you