nRF24l01 library help

hi im trying to make 2 arduinos communicate via nrf24l01 library but the following code is not working

arduino micro + nrf24l01

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
RF24 radio(8,7);
const uint64_t pipe = 0xE8E8F0F0E1LL;
byte a[10];
int i;
void setup()
{
   Serial.begin(57600);
  printf_begin();
  radio.begin();
  radio.openReadingPipe(1,pipe);
    radio.startListening();
      radio.printDetails();

}
void loop()
{
  
 if (radio.available())
 {
   boolean done = false;
   while(!done)
   {
 done = radio.read( a, 10 );
   }
 for(i=0;i<=10;i++)
 {
   Serial.println(a[i]);
 }
 
 }
   
}

Duemilanove with 168 bootloader + nrf24l01

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
RF24 radio(8,7);
const uint64_t pipe = 0xE8E8F0F0E1LL;
byte data[8];
void setup()
{
   Serial.begin(57600);
  printf_begin();
  radio.begin();
  radio.openWritingPipe(pipe);
}
void loop()
{
    int d,a;
  a=1;
  d=Serial.read();
  switch(d)
{
  case'a':
   Serial.println("arming.....");
   data[0]=0x00;
  data[1]=0x00;
  data[2]=0x00;
  data[3]=0x00;
  data[4]=0x00;
  data[5]=0xFF;
  data[6]=0x00;
  data[7]=0x00;
   Serial.println("ARMED......");
 break;
 case 'b':
    Serial.println("Disarming...."); 
      data[0]=0x00;
  data[1]=0x00;
  data[2]=0x00;
  data[3]=0x00;
  data[4]=0x00;
  data[5]=0x00;
  data[6]=0xFF;
  data[7]=0x00;
     Serial.println("disarmed......."); 
 
      
 break;
  case 'c':

    data[0]=0x00;
  data[1]=0x64;
  data[2]=0x00;
  data[3]=0x00;
  data[4]=0x00;
  data[5]=0x00;
  data[6]=0x00;
  data[7]=0x00;
     Serial.println("MED"); 
 
      
 break;
  case 'e':

    data[0]=0xFF;
  data[1]=0xFF;
  data[2]=0x00;
  data[3]=0x00;
  data[4]=0x00;
  data[5]=0x00;
  data[6]=0x00;
  data[7]=0x00;
     Serial.println("MAX"); 
 
      
 break;
}
 
  
  
  radio.write( data, 8 );
   
 
}

is there any programming error or the logic is itself wrong ?
thanks in advance.

Have you run the sample ping sketch to confirm the hardware is working correctly?

yeah it is working but even if i switch off the transmitter the receiver is getting a reply
i have attached the ce and csn pin to 8 and 7 and i have declared it in the program will it affect the transmission in a negative way ?

CyrilAnthony:
yeah it is working but even if i switch off the transmitter the receiver is getting a reply

Huh?

Could you explain that in a bit more detail?

this is a part of the output which i get irrespective of the pong back status
micro + nrf24l01

Now sending 86805...ok...Got response 4294967295, round-trip delay: 86807

Now sending 87808...ok...Got response 4294967295, round-trip delay: 87810

Now sending 88810...ok...Got response 4294967295, round-trip delay: 88813

Now sending 89814...ok...Got response 4294967295, round-trip delay: 89816

Now sending 90816...ok...Got response 4294967295, round-trip delay: 90818

Now sending 91819...ok...Got response 4294967295, round-trip delay: 91822

Now sending 92822...ok...Got response 4294967295, round-trip delay: 92824

Now sending 93825...ok...Got response 4294967295, round-trip delay: 93827

Now sending 94827...ok...Got response 4294967295, round-trip delay: 94830

Now sending 95830...ok...Got response 4294967295, round-trip delay: 95833

Now sending 96833...ok...Got response 4294967295, round-trip delay: 96835

Now sending 97836...ok...Got response 4294967295, round-trip delay: 97839

and this is what i get in the pong back side irrespective of the transmitter side
mega 1280+nrf24l01

RF24/examples/pingpair/

ROLE: Pong back

Got payload 4294967295...Sent response.

Got payload 4294967295...Sent response.

Got payload 4294967295...Sent response.

Got payload 4294967295...Sent response.

Got payload 4294967295...Sent response.

Got payload 4294967295...Sent response.

Got payload 4294967295...Sent response.

just to be sure have i wired it correctly?

nrf24l02----->Arduino
gnd----->gnd
vcc----->3.3v
ce----->9
csn----->10
sck----->13
MOSI---->11
MISO----->12
IRQ----->2

i have used RF24 library and arduino ide 1.0.3
im suspecting a radio interference

Do you have reason for connecting the IRQ? I understood it is usually unnecessary.

CyrilAnthony:
this is a part of the output which i get irrespective of the pong back status

Does that demonstrate "even if i switch off the transmitter the receiver is getting a reply" somehow? I'm not seeing it.

well i found that the problem is with my micro it is not going well with my nrf24l01 module when i test it with my mega and uno pair it is working well

I just hit the exact same issue with my Arduino Micro. And, I have a solution!

The RF24 library uses digital pins 11, 12 and 13 for SPI communication with the nRF24L01. However, on Arduino Micro, the SPI pins are different! If you check the documentation http://arduino.cc/en/Main/arduinoBoardMicro, you'll find this:

Note that the SPI pins are not connected to any of the digital I/O pins as they are on the Arduino Uno, they are only available on the ICSP connector and on the nearby pins labelled MISO, MOSI and SCK.

Essentially, instead of connecting the nRF24L01's pin 5, 6 and 7 to Arduino's 11, 12 and 13, connect it to the SCK, MOSI and MISO pins:

Arduino Micro --> nRF24L01
SCK 5
MOSI 6
MISO 7