#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#define CE_PIN 7
#define CSN_PIN 8
// Create Radio and define pins
RF24 radio(CE_PIN, CSN_PIN);
// Create Radio channels
const byte address[6] = "00001";
//Radio recived array
int recivedDataArray[4];
void setup() {
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_MIN);
radio.startListening();
}
void loop() {
if (radio.available()) {
radio.read( &recivedDataArray, sizeof(recivedDataArray) );
Serial.print("Recieved array:");
for (byte i = 0; i < 4; i++) {
Serial.println(recivedDataArray[i]);
}
Serial.println();
}
}
I get the error "Transmition failed" in my serial monitor. If you can find something ive done wrong in my code it would be very helpful . Thanks beforehand!
@6v6gt Oh! I didnt see that, I changed it and found that I wired the CSN and CE port wrong, but it still doesnt print out anything inside radio.avalible()
open a Serial monitor for each arduino (so you need a terminal application as the IDE can only open one)
whatever you type on one side should appear on the other side
➜ if that works then you know your setup is likely OK. (which is likely not unless you have a cap to answer to peak demand when transmitting and your Tx might require to be changed from 5V ➜ 3.3V to not burn your module).
My code has been used successfully many times so it's supposed to work.
if it did not work with my code then you likely have an Hardware issue.
did you add the cap?
Yes, but there was no difference, I have tested multiple modules but nothjing seems to work. I got it working about a month ago but I accidently ruined my old arduinos usb so I could not reprogram it. I have the scimatics for it but it doesnt work on my new arduino for some reason.