Hello,
i'm currently trying to get 2 NRFL2401+ to work with 2 Arduino Micros and the RF24 Library, but it seems harder than i expected.
The problem isn't the cabling or the general hardware. At least i think so...
Actually i'm just trying to send an int from one Micro to the other one and display this on the serial monitor. An extensive Google search didn't help and the german forum doesn't seem to know an answer.
Here's my code for the transmitter:
// RF24 Bibliothek einbinden
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
// Pipe erstellen (LL = LongLong)
const uint64_t pipe = 0xE8E8F0F0E1LL;
// Radio erzeugen
RF24 radio( 9, 10 );
// int zum uebertragen
int test;
void setup() {
test = 1;
Serial.begin( 9600 );
radio.begin();
radio.openWritingPipe( pipe );
}
void loop() {
if ( radio.available() ) {
radio.write( &test, sizeof( test ) );
Serial.println( test );
delay( 1000 );
} else {
Serial.println( "Radio not available" );
}
}
And for the receiver:
// Bibliothek einbinden
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
// Pipe erzeugen (LL = LongLong)
const uint64_t pipe = 0xE8E8F0F0E1LL;
// Radio erzeugen
RF24 radio( 9, 10 );
int test;
void setup() {
Serial.begin( 9600 );
radio.begin();
radio.openReadingPipe( 1, pipe );
radio.startListening();
}
void loop() {
if ( radio.available() ) {
radio.read( &test, 10 );
Serial.println( test );
} else {
Serial.println( "Radio not available" );
}
}
Thanks for every hint