how to use Serial.find() function in arduino

Status
Not open for further replies.
Here is a short example:

Code:
boolean isOKFound = Serial.find("OK\r\n");    //Search for 'OK' string response from GSM module
                                              //return true if found, or false if string is not found after 1 second
//or

Serial.setTimeout(5000);
boolean isOKFound = Serial.find("OK\r\n");    //Wait for 'OK' for 5 seconds
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…