NRFL24 SPI works on UNO but not Mega

Good morning . I have a short program that works fine with UNO's but after three days can't get MEGA to play ball.
I am using a NRFL24L01 to link two boards, I am using the correct pins 50,51,52 with 7 and 8 on the MEGA.
The power supplies are stable and have decoupling capacitors next to the RF units. Pin 53 is taken LOW.
I have looked at as much as i can but can't explain why it is not working. Is there something in the library which is not combatable?

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
//#define button1 3
//#define button2 5
#define SS 53
RF24 radio(7, 8); // CE, CSN
const byte addresses[][6] = {"00001", "00002"};
int button1State = 0;
int button2State = 0;

void setup() {
pinMode(SS, OUTPUT);
digitalWrite(SS, LOW);
radio.openWritingPipe(addresses[1]); // 00002
radio.openReadingPipe(1, addresses[0]); // 00001
void loop() {
int potValue = analogRead(A0);
int angleValue = map(potValue, 0, 1023, 0, 180);
radio.write(&angleValue, sizeof(angleValue));
/* button1State = digitalRead(button1);
radio.write(&button1State, sizeof(button1State));

button2State = digitalRead(button2);
radio.write(&button2State, sizeof(button2State));*/
Any advice please.

Where do the NRF24s get their 3.3V supply from ?

HI srnet, 3v3 supply is from a separate L787L33 voltage reg with 47uF decoupling right next to pins.

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.