hi . Please Help a newbie !
i have a problem with interfacing the NRF24L01+ module with Arduino Leonardo board !
this nrf module works well with arduino UNO . the arduino can receive and send data ! ( MISO 12 , MOSI 11, SCK 13 )
i tried different wiring methods . i tried like the UNO using the 11 12 13 digital pins of the leonardo , and didn't work .
i also use the ICSP headers to connect the MOSI MISO SCK and it didn't work !
CE/CSN to 9/10 , i also tried 8/10 ! nothing happened . the leonardo doesn't receive nothing !
here is the code for the receiver board ( leonardo)
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9, 10); // nRF24L01 (CE, CSN)
const byte address[6] = "00001";
struct Data_Package {
byte jaxisX;
byte jaxisY;
byte jButton;
byte button1;
byte button2;
byte button3;
byte button4;
byte button5;
byte button6;
};
Data_Package data;
void setup() {
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setAutoAck(false);
radio.setDataRate(RF24_250KBPS);
radio.setPALevel(RF24_PA_LOW);
radio.startListening(); // Set the module as receiver
}
void loop() {
if (radio.available()) {
radio.read(&data, sizeof(Data_Package));
Serial.print("data.jaxisX ");
Serial.println(data.jaxisX);
Serial.print("data.jaxisY ");
Serial.println(data.jaxisY);
Serial.print("data.jButton ");
Serial.println(data.jButton);
Serial.print("data.button1 ");
Serial.println(data.button1);
Serial.print("data.button2 ");
Serial.println(data.button2);
Serial.print("data.button3 ");
Serial.println(data.button3);
Serial.print("data.button4 ");
Serial.println(data.button4);
Serial.print("data.button5 ");
Serial.println(data.button5);
Serial.print("data.button6 ");
Serial.println(data.button6);
Serial.println("*************************");
//delay(500);// to easly read the data in serial monitor
}
}
and i use the wiring in this pic and the same module