AsciiMassage
|
AsciiMassage allows the sending and receiving of messages. More precisely, it is a microcontroller massage packer and parser for the ASCII format for any type of stream (Serial, UDP, etc). A massage message always starts with an address string and is followed by a user defined number of elements (bytes, ints, longs, floats or strings). The address string is used to route the message.
This is the ASCII implementation of the Massage API.
https://github.com/SofaPirate/AsciiMassage
The complete class documentation can be found in the "docs" folder or online here.
Add the library to the top of your code and instantiate an AsciiMassagePacker called "outbound":
Pack a massage and then steam it through Serial:
Add the library to the top of your code and instantiate an AsciiMassageParser called "inbound":
Inside loop() parse the Serial stream with parse(). If parse() returns true, the massage is completed and ready.
This example parses the elements of a massage that starts with the address "value" and that contains one long followed by one int:
The complete block of code is as follows: