#include <SPI.h>
#include <RF24_config.h>
#include <RF24.h>
#include <printf.h>
#include <nRF24L01.h>
RF24 radio(7,8);
byte addresses[][6] = {"12"};
typedef struct
{
int x, y, z;
}dataStruct;
dataStruct data;
void setup()
{
Serial.begin(115200);
radio.begin();
radio.openReadingPipe(0, addresses[0]);
radio.startListening();
}
void loop()
{
if(radio.available())
{
radio.read(&data,sizeof(data));
Serial.print(data.x);
Serial.print(",");
Serial.print(data.y);
Serial.print(",");
Serial.print(data.z);
Serial.print(",");
Serial.println();
}
}
#include <RF24_config.h>
#include <RF24.h>
#include <printf.h>
#include <nRF24L01.h>
RF24 radio(7,8);
byte addresses[][6] = {"12"};
typedef struct
{
int x, y, z;
}dataStruct;
dataStruct data;
void setup()
{
Serial.begin(115200);
radio.begin();
radio.openReadingPipe(0, addresses[0]);
radio.startListening();
}
void loop()
{
if(radio.available())
{
radio.read(&data,sizeof(data));
Serial.print(data.x);
Serial.print(",");
Serial.print(data.y);
Serial.print(",");
Serial.print(data.z);
Serial.print(",");
Serial.println();
}
}