I'm able to establish a communication channel between two nRF24L01+. But once I kick in a second listener, only one of them gets the message. Funny enough, it's always the same that "wins" in the situation where two are listening. Is there any way of having multiple receivers (like a broadcast?)
Here's the receiving code I'm using for the Arduino:
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
#define channel 0x4c // nrf24 communication channel
#define writingPipe 0xF0F0F0F0E1LL // nrf24 communication address
#define dataRate RF24_250KBPS // nrf24 data rate (lower == more distance)
#define paLevel RF24_PA_HIGH // nrf24 power level (black ebay models have some problems with PA_MAX)
RF24 radio(8,7);
char receive_payload[33]; // +1 to allow room for a terminating NULL char
void setup(void) {
Serial.begin(57600);
printf_begin();
radio.begin();
radio.setPALevel(paLevel);
radio.setChannel(channel);
radio.openReadingPipe(0, writingPipe);
radio.enableDynamicPayloads();
radio.setDataRate(dataRate);
radio.setAutoAck(false);
radio.startListening();
radio.printDetails();
}
void loop(void) {
// if there is data ready
if (radio.available()) {
uint8_t len;
bool done = false;
while (!done) {
// Fetch the payload, and see if this was the last one.
len = radio.getDynamicPayloadSize();
done = radio.read(receive_payload, len);
// Put a zero at the end for easy printing
receive_payload[len] = 0;
// Spew it
printf("Got payload size=%i value=%s\n\r", len, receive_payload);
}
}
delay(1000);
}