I want to transmit some measured Values via 433MHZ transmitter and receiver from one Arduino nano to the other.
For testing purpose I am using fixed Values. I can transmit these values but now I need to split the received data into 8 values.
And I dont know how to split these values.
This is what I receive in the Serial Monitor:
100|101|102|103|110|111|112|113x
I want to use | to split the values and the x indicated the end of the transmitted data
Transmitter Script
#include <VirtualWire.h>
#undef int #undef abs #undef double #undef float #undef round
char buf[30];
byte A1 = 100;
byte B = 101;
byte C = 102;
byte D = 103;
byte E = 110;
byte F = 111;
byte G = 112;
byte H = 113;
You could do worse than read up on the strtok function (although for the Arduino I believe it's called strtok_r as it is "re-entrant safe", like that's going to bother you!).
Plenty of examples in this forum and on the 'net. I hope this points you in a positive direction
No one uses a text string to transmit binary data. Use an array of bytes or integers or floats, or a struct or union.
What is the maximum size for VirtualWire ? I forgot what it was, was it about 28 bytes ? You transmit more.
What is this?
#undef int
#undef abs
#undef double
#undef float
#undef round
I have seen that before, but I don't understand it. If you don't understand it as well, I suggest to remove it.
Koepel:
No one uses a text string to transmit binary data. Use an array of bytes or integers or floats, or a struct or union.
What is the maximum size for VirtualWire ? I forgot what it was, was it about 28 bytes ? You transmit more.
// create an array of bytes
byte myData[8];
// fill it with data
myData[0] = 100;
myData[1] = 101;
myData[2] = 150;
// transmit it
// Use 8 for size, or sizeof(myData)
vw_send((uint8_t *) myData, sizeof(myData));
// receive it
// Use the 'buf' directly or copy it in a myData array
if (vw_get_message(buf, &buflen))
{
for (int i = 0; i < buflen; i++)
{
Serial.print( buf[i]);
Serial.print( ", ");
}
...