I'm working under a project limitation that only allows me to send 10 bytes packages to communicate two components. I was wondering how could I use these 10 bytes more efficiently since I am only using integer numbers. My idea was to write it all in binary format so that instead of having only 10 ASCII characters per package I could have approx. 20 numbers per package. How can I do it and which problems I could expect to run into?
Well, I am trying to send packages through a LoRa WAN calling a function LoRa.print(number) that basically "writes" the 'number' variable on the network for a second device to read it. By doing this with '255' my package would contain 3 bytes and what I aim to do is to use only 12 bits for this specific case, like '0010 0101 0101' (character by character) or even '11111111' (whole value). This would allow me to pack more data into each package.
But I don't intend to mess with the LoRa library to solve this. I was wondering if it exists on Arduino something like:
Which LoRa library are you using. Doing this with write() and read() seems pretty low-level. I wouldn't be surprised if the library has higher-level functions allowing you to send an entire struct at once (as binary). If it doesn't, check out the RadioHead Library.