char search[]= "COMMAND-"; //Defined a search string to look for the command amongst the noise
void setup() {
Serial.begin(115200);
Serial1.begin(115200); // Serial1 is connected to the custom chip
Serial.println("Data received from UART chip:");
}
void loop() {
while (Serial1.available()) { //looks for data on UART line
if (Serial1.find(search)){//the find function to look for the command in the stream of noise
delay(10); //delay gives the mcu a chance to capture the command character from stream
Serial.print(search);// prints the search string
Serial.print((char)Serial1.read());//prints the command character
}
}
}