i am writing a one to one communication with using nRF24l01
I downloaded the library at GitHub - nRF24/RF24: OSI Layer 2 driver for nRF24L01 on Arduino & Raspberry Pi/Linux Devices
For transmitter,
#include <SPI.h>
#include "RF24.h"RF24 rf24(9, 10);
const byte addr[] = "1Node";
const char msg[] = "Happy Hacking!";void setup() {
rf24.begin();
rf24.setChannel(83);
rf24.openWritingPipe(addr);
rf24.setPALevel(RF24_PA_MIN);
rf24.setDataRate(RF24_250KBPS);
rf24.stopListening();
}void loop() {
rf24.write(&msg, sizeof(msg));
delay(1000);
}
For the receiver,
#include <SPI.h>
#include "RF24.h"RF24 rf24(7, 8);
const byte addr[] = "1Node";
const byte pipe = 1;void setup() {
Serial.begin(9600);
rf24.begin();
rf24.setChannel(83);
rf24.setPALevel(RF24_PA_MIN);
rf24.setDataRate(RF24_250KBPS);
rf24.openReadingPipe(pipe, addr);
rf24.startListening();
Serial.println("nRF24L01 ready!");
}void loop() {
if (rf24.available(&pipe)) {
char msg[32] = "";
rf24.read(&msg, sizeof(msg));
Serial.println(msg); /
}
}
Actually I just copy and paste the tutorial that I found in internet, and I found that there are some error in it but the arduino board can still compile it.
is it the problem that i cannot receive any signal from my receiver?
warning: invalid conversion from 'const byte* {aka const unsigned char*}' to 'uint64_t {aka long long unsigned int}' [-fpermissive]
rf24.openReadingPipe(pipe, addr);
note: initializing argument 2 of 'void RF24::openReadingPipe(uint8_t, uint64_t)'
void openReadingPipe(uint8_t number, uint64_t address);
initializing argument 1 of 'bool RF24::available(uint8_t*)'
bool available(uint8_t* pipe_num);
How can I fix these error?
Also, when I use Serial.println(rf24.available(&pipe)), it only shows 0. how can I let the rf24 available?
please let me know, thank you very much