diff --git a/README.md b/README.md index 3636eff..b2e5cba 100644 --- a/README.md +++ b/README.md @@ -20,4 +20,27 @@ Bellow is a high level overview on how the communications protocol works and wha ![image](docs/CommsProtocol.png) -It is important to note that the user never sees the ACKG/RPT commands be sent or the validation process take place. All the end user sees is the action assigned to a given command be executed once it's been confirmed as intact. \ No newline at end of file +It is important to note that the user never sees the ACKG/RPT commands be sent or the validation process take place. All the end user sees is the action assigned to a given command be executed once it's been confirmed as intact. + +# Using The Library + +This section describes how to get the library working in a project of your own. + +## Importing Into A New Project + +To import the library in to a project of your own there are only two files you need to bring in. One is `src/serialConnector.cpp` and the other is its associated header file `include/serialConnector.h`. Once those two are coppied these two in to your project make sure the includes are still correct. Then in your `main.cpp` you need to create a new instance of the `SerialConnector` class and to parse any incomming commands you need to call the newly created instance's `cycle` method. Bellow is an example of what that would look like. + +```cpp +#include + +SerialConnector *conn = new SerialConnector() + +void setup() {} + +void loop() +{ + conn->cycle(); +} +``` + +Any time the cycle method is called it scans the serial buffer for any new commands and if there's something it processes those incomming commands it automatically processes that command, checks it's integrity and executes any handler functions associated with it.