I'm fairly new to C++ (usually programming in C#) and am experiencing a difficulty in understanding the following:
"what data type I am passing".
The project is related with NRF24L; where I exchange data (actually a string) from Nano Emitter to Nano Receiver Modules.
I believe this is irrelevant; however I'm using Keywish RF-Nanos and his libraries as well.
Link for Keywish Library and Demo Projects (Hope this is not considered Thread Hijacking):
Note: The original code from Keywish, actually sends an integer and not a string.
integer works fine; however it won't work correctly if I'm passing a String.
These are the 2 lines I am struggling with:
(I find it hard to understand and learn; specially due to the lack of intellisense in Arduno IDE)
// Emitter Code Line:
Mirf.send((byte *)&txValue);
// Receiver Code Line:
Mirf.getData((byte *) &rxValue);
//Note: Both txValue and rxValue are String variables.
What I understand here is that I send an unsigned byte; pointed to a String value.
An array of bites is sent containing the string information (or text).
The output received however is similar to inconsistent baud rates (where weird characters are printed).
Can you help me understand this line and what I should be doing to receive the string correctly?
I think I've found one of the issues.
I was checking the "Mirf" library for the send method (in this case for the Emitter Code).
// Sends a data package to the default address. Be sure to send the amount of bytes as configured as payload on the receiver.
void Nrf24l::send(uint8_t * value)
First error found I'm requesting / sending a string when the library datatype to be passed is actually uint8_t *
My experience with C++ classes ain't that good, so; either i pass an integer or change the library (wich I really don't intent to - Will certainly raise lots of errors)