Go Down

Topic: NRF24L01 And Ethernet Shield NOT Working Together On Mega 2560 (Read 700 times) previous topic - next topic

gully

Hi everyone,

I am getting a error when i try and use the NRF24L01 with a ethernet shield

When I use the following code it knocks out the RF, How would i get them both to work with each other? i need to get the data from the web and then send it via RF. When i remove the following Ethernet.begin(mac) the RF starts sending out the data.

#include <SPI.h>
#include <Ethernet.h>
#include <Mirf.h>
#include <nRF24L01.h>
#include <MirfHardwareSpiDriver.h>
int data;

byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
char server[] = "www.*********.com";
EthernetClient client;

void setup(){
  Serial.begin(9600);
    Mirf.spi = &MirfHardwareSpi;
   Mirf.cePin = 48;
  Mirf.csnPin = 49;
  Mirf.init();
  Mirf.setRADDR((byte *)"clie1");
  Mirf.config();
  Mirf.payload = sizeof(data);
  Mirf.channel = 67;


}

void loop(){


        if (Ethernet.begin(mac) == 0) {
  }

 
 
  //byte data[Mirf.payload];
  data = 8888;
  Mirf.setTADDR((byte *)"serv1");
 
  Mirf.send((byte*)&data);
 
  while(Mirf.isSending()){
  }
  Serial.println("Finished sending");
  delay(10);
}

Thank you for taking the time to read and if you have replied thank you

PeterH

I suppose your Ethernet shield could be conflicting with some of the pins used to connect to the nRF24L01. I suggest you look at the documentation for it and work out which pins it uses.
I only provide help via the forum - please do not contact me for private consultancy.

Go Up