A simple interface for serial communication.
See Example Public Methods Release NotesThe Arduino Serial object provides a great general purpose interface for sending and receiving serial commands. This library takes care of the details and allows you to quickly define and consume an event-based serial protocol.
This is an alpha release, which means this library is functional but likely to change. Please post feedback, questions, and issues to this GitHub issues page.
Note: this library will look for a \n newline character at the end of each command. You must configure the Arduino Serial Monitor to include a \n newline character (next to baud rate), or call setFlag() to change the default value.
This library communicates over the Arduino USB port set at 115200 baud:
Create a new Serial Manager instance.
Begin serial communication over the Arduino USB cable at 115200 baud. This method must be called in setup() in order to use this library.
Provide a char to change the identifier that denotes the end of each serial command. This library defaults to having a terminating flag of \n newline character. You must configure the Arduino Serial Monitor to include a newline (next to baud rate) for this library to work by default.
Provide a char to change the identifier between parameters in serial commands. This library defaults to having a delimiter of , comma.
Returns true when a setFlag() has been identified in the serial communication input stream and the parsed data is available from getValue().
In order for this library to behave correctly; you must wrap all real-time methods in a conditional with this method (as shown below).
Returns a String of data parsed in chunks between setFlag() from the serial communication input stream. This method must be used with onReceive() for this library to behave correctly (as shown below).
Returns a String of data that is the first (or only) parameter parsed from getValue(). This enables a serial command structure that follows a cmd,param template. This method must be used with onReceive() for this library to behave correctly (as shown below).
Returns a String of data that is the second parameter parsed from getValue(). This enables a serial command structure that follows a cmd,param template. This method must be used with onReceive() for this library to behave correctly (as shown below).
Provide a String to see if it matches the current getCmd(). This method must be used with onReceive() for this library to behave correctly (as shown below).
Provide a String to see if it matches the current getParam(). This method must be used with onReceive() for this library to behave correctly (as shown below).
Provide any value to print to serial output. This is identical to the documented Arduino Serial.print() function.
Provide any value to print to serial output, then a carriage return and newline character will be appended. This is identical to the documented Arduino Serial.println() function.