Arduino Forum

Using Arduino => Programming Questions => Topic started by: gully on Jan 09, 2013, 01:39 am

Title: NRF24L01 And Ethernet Shield NOT Working Together On Mega 2560
Post by: gully on Jan 09, 2013, 01:39 am
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
Title: Re: NRF24L01 And Ethernet Shield NOT Working Together On Mega 2560
Post by: PeterH on Jan 09, 2013, 02:23 am
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.