Hi all,
I have been playing around with RF24 modules, got most of the examples working, but I wanted to some proper test runs transferring sensor values and text, managed to find a tutorial on youtube.
My sending code works, which is doing what it is supposed to, by serial at least, however my receiver code, is part working, but does not seem to be picking up the values.
The code for the receiver is below
#include <SPI.h>
#include "RF24.h"
RF24 myRadio (7, 8);
struct package
{
int id=0;
float temperature = 0.0;
char text[100] ="empty";
};
byte addresses[][6] = {"0"};
typedef struct package Package;
Package data;
void setup()
{
Serial.begin(115200);
delay(1000);
myRadio.begin();
myRadio.setChannel(115);
myRadio.setPALevel(RF24_PA_MAX);
myRadio.setDataRate( RF24_250KBPS ) ;
myRadio.openReadingPipe(1, addresses[0]);
myRadio.startListening();
}
void loop()
{
if ( myRadio.available())
{
while (myRadio.available())
{
myRadio.read( &data, sizeof(data) );
}
Serial.print("\nPackage:");
Serial.print(data.id);
Serial.print("\n");
Serial.println(data.temperature);
Serial.println(data.text);
}
}
This is the form of results I got
Package : 0
Temp = 0.00
Text =
Package :-10024
Temp = 0vf
Text = oooooooooooo ( looks like square hollow boxes)
Package : -10024
Temp = 0vf
Text = oooooooooooo
So far, I can changed to RF24 modules, same thing.
I have multiple modules, arduino's .
This is just for testing and debugging, I have a temperature sensor working, humidity and various other sensors working on other boards.
I am trying to make an automatic home system, but cant figure out why this is not working, I have read the library, and the datasheet.