I'm new to all this Arduino stuff. But I would like to build my own RC car. And I've already watched a few videos and read a lot of websites about how to build and configure one. But I have a problem with the nRF24L01 + PA + NLA component. For some reason it doesn't work.
I'm using two Arduino NANOs and two nRF24L01 + PA + NLA components with two adapters.
Adaptor -> NANO
VVC -> 5V
GND -> GND
CE -> D7
CSN -> D8
SCK -> D13
MO -> D11
MI -> D12
//receiver
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
// Instantiate RF24 class with CE and CSN values
RF24 radio(7, 8);
// Address to devices comunicate each other (same in both)
const uint64_t pipe = 0xE8E8F0F0E1AA;
void setup() {
// Setup serial output
Serial.begin(9600);
// Start RF
radio.begin();
// Setup the channel to work within, number 110
radio.setChannel(110);
// Open recept pipe
radio.openReadingPipe(1, pipe);
// Start to listen
radio.startListening();
}
void loop() {
//just debug, to see if there is a connection
Serial.print("Available: ");
Serial.println(radio.available());
// Wait until some data
if (radio.available()) {
// Read payload, and check if it finished
char txt[32] = "";
radio.read(&txt, sizeof(txt));
Serial.println(txt);
}
// Wait a bit
delay(100);
}
Output:
Available: 0
Available: 0
//transmitter
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
// Instantiate RF24 class with CE and CSN values
RF24 radio(7, 8);
// Address to devices comunicate each other (same in both)
const uint64_t pipe = 0xE8E8F0F0E1AA;
// my string i want to send
const char txt[32] = "Hello World!";
void setup() {
// Setup serial output (debug)
Serial.begin(9600);
// Start RF
radio.begin();
// Setup the channel to work within, number 110
radio.setChannel(110);
// Open wite pipe
radio.openWritingPipe(pipe);
radio.stopListening();
}
void loop() {
//Send message to receiver
radio.write(&txt, sizeof(txt));
//debug to see if there is a conection (not sure if i can even do that on the transmitter side)
Serial.print("Available: ");
Serial.println(radio.available());
// Wait 2 seconds and repeat
delay(2000);
}
Output:
Available: 0
Available: 0
Can someone help me?