This library was creted by me and Bartek Szodny for a research paper we wrote which is available here.
First add a library to Your PlatformIO project, either using the library registry or by adding the lines below to Your platformio.ini
lib_deps = rajzer/ESP Meshed@^0.0.2You can then include the library as any other
#include <esp-meshed.h>The library creates a singleton class with its own access method.
ESPMeshedNode* node = GetESPMeshedNode();To send messages simply use the sendMessage method, it takes in a 12-bit adress, and up-to 245 bits of data.
int data[5] = {1, 2, 3, 4, 5};
int data_length = 5;
node->sendMessage(*data, data_length, peer_adress);To establish what happends when a message is received, You can set a callback either when getting the instance, or by using the setter.
void recvHandler(uint8_t *data, uint8_t len, uint16_t from)
{
// Something happens to Your data here...
}
node->setReceiveHandler(recvHandler);To see more ways to use this library please checkout the examples provided in the examples directory.