i assembled a code for master and slave solar tracker, using NRF transmitter and receiver.
this there any thing wrong in the following line which is bolded?
im getting error in this line
the code is attached below
if ( radio.available() )
{
// Read the data payload until we've received everything
bool done = false;
while (!done)
{
// Fetch the data payload
** done = radio.read(sensor,sizeof(sensor) );**
please help
SlavePanel_FYP.ino (3.75 KB)
It appears to be because you are attempting to stuff an integer into a variable that was just declared as a bool/boolean.
void loop() {
if ( radio.available() )
{
// Read the data payload until we've received everything
bool done = false;
while (!done)
{
// Fetch the data payload
done = radio.read(sensor,sizeof(sensor) );
Although I am not sure what error you are getting.
There are 2 versions of the RF24 library. One has the read function is declared to return a boolean and the other is declared void. In the library that you have the read function is declared void, but you are asking for a boolean return value.
bool done = false;
while (!done)
{
// Fetch the data payload
done = radio.read(sensor,sizeof(sensor) );
You are not really using the done variable anyway, so, I think, that you can get rid of it.
Then there is this:
if (++1 * tol > dvert || dvert > tol) // check if the diffirence
What does ++1 do (besides cause an error)?