-
Notifications
You must be signed in to change notification settings - Fork 7
getString()
CreateiveRobotics edited this page Mar 7, 2020
·
2 revisions
bool getString(String &myString)
Copy the next item in the payload into the myString object. If the attempt was successful myString will be updated, and the method will return true.
If there are multiple items in the payload, repeated calls to this method will return each item in turn until there are no more items and the method returns false.
example: Single item
String myStr = "";
if(cmd.getString(myStr)){
cmd.print("Success, my String is: ");
cmd.println(myStr);
}
example: Read and print every single item
String myStr = "";
while(cmd.getString(myStr)){
cmd.print("Success, my String is: ");
cmd.println(myStr);
}