From f733bde53fec0d8eedb483decf1464c53fe3d732 Mon Sep 17 00:00:00 2001 From: Lyubomir Penev Date: Sun, 25 Jan 2026 17:52:15 +0100 Subject: [PATCH] Added sending a command --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index b2e5cba..b587a64 100644 --- a/README.md +++ b/README.md @@ -44,3 +44,22 @@ void loop() ``` 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. + +## Sending A Command + +The instance of the `SerialConnector` class contains a method called `sendCommand` which takes in two parameters as Strings. The first parameter is the name of the command being sent and the second parameter are any arguments associated with the command. So if we wanted to send the example command from above `ERR#Something went wrong#4342@` it would look something like this + +```cpp +#include + +SerialConnector *conn = new SerialConnector() + +void setup() {} + +void loop() +{ + conn->sendCommand("ERR", "Something went wrong"); +} +``` + +The code above will automatically generate the command packet and send it, and process the incomming acknowledge or repeat packets from the receiver. \ No newline at end of file