دوست من اکیدا پیشنهاد می کنم از کدی که تو سایت هست در این لینک فروم استفاده کنی:
http://forum.arduino.ir/8/21/144.html

کد آمادش میشه اینا:

سمت فرستنده:

#include <SPI.h>
#include <Mirf.h>
#include <nRF24L01.h>
#include <MirfHardwareSpiDriver.h>

const int MAX_BUFFER_LEN = 16;
String Receive_Address = "clie1"; //A name that is dedicated to this station; MAX is 5 Char.
String Send_Address = "clie2"; //A name that is dedicated to another station; MAX is 5 Char.

byte Transfer_Lock = 0;

void setup()
{
Serial.begin(9600);
Setup_Mirf(); // initializing overall needed...
sendData("TALK");
}

void loop()
{
if (digitalRead(13) == HIGH) {
sendData("1");
}

}


//This function sends a 4 byte packet
void sendPacket(char packet[5])
{
Mirf.send((byte *)packet);
while (Mirf.isSending());
}

//This function sends data
void sendData(String strData)
{
int StrLen = 0;
String tmp_Str = "";
Serial.print("sending data: ");
Serial.print(strData);
Transfer_Lock = 1;
StrLen = strData.length();
Serial.print(" : ");
Serial.println(StrLen);

//parsing the data to 4 character packets (byte *)packet
while (StrLen > 0)
{
char tmp_Char[5] = {0};
if (StrLen > 4)
{
tmp_Str = strData.substring(0, 4);
strData = strData.substring(4);
}
else
{
tmp_Str = strData;
strData = "";
}
tmp_Str.toCharArray(tmp_Char, 5);;
sendPacket(tmp_Char);
StrLen = strData.length();
}
Transfer_Lock = 0;
}

//This function initializes overall needed for wireless communication
void Setup_Mirf()
{
char Receive_Adr_Char[6];
char Send_Adr_Char[6];
Receive_Address.toCharArray(Receive_Adr_Char, 6);
Send_Address.toCharArray(Send_Adr_Char, 6);

Mirf.spi = &MirfHardwareSpi;
Mirf.init();
Mirf.setRADDR((byte *)Receive_Adr_Char);
Mirf.setTADDR((byte *)Send_Adr_Char);
Mirf.payload = sizeof(unsigned long);
Mirf.config();

//reg - Start
byte rf_setup = 0;
Mirf.readRegister( RF_SETUP, &rf_setup, sizeof(rf_setup) );

if (rf_setup != 0)
Serial.println("Beginning ... ");
else
{
Serial.println( "Wireless did not initialize!" );
while (rf_setup == 0);
}
delay(100);
}

سمت گیرنده:

#include <SPI.h>
#include <Mirf.h>
#include <nRF24L01.h>
#include <MirfHardwareSpiDriver.h>

const int MAX_BUFFER_LEN = 16;
String Receive_Address = "clie2"; //A name that is dedicated to this station; MAX is 5 Char.
String Send_Address = "clie1"; //A name that is dedicated to another station; MAX is 5 Char.

String strMirfBuffer="";
byte Transfer_Lock=0;

void setup()
{
Serial.begin(9600);
Setup_Mirf(); // initializing overall needed...
}

void loop()
{
if (!Mirf.isSending())
check_MirfBuffer();
}

//This function checks mirf data availability. if data is available, put it in the buffer and generates an event.
void check_MirfBuffer()
{
if (Mirf.dataReady())
{
while(Mirf.dataReady())
{
int tmp_index=0;
byte tmp_buffer[4]={0};
Mirf.getData(tmp_buffer);
while(tmp_buffer[tmp_index] && tmp_index<4 )
{
strMirfBuffer = strMirfBuffer + char(tmp_buffer[tmp_index]);
tmp_index++;
}
if (strMirfBuffer.length() >= MAX_BUFFER_LEN )
buffer_ready();

if (!Mirf.dataReady())
delay(2);
}
}
else if (strMirfBuffer.length()>0 )
buffer_ready();
}


//This function parses received commands from another nrfs.
void buffer_ready()
{
if (strMirfBuffer == "1")
{
digitalWrite(13,HIGH);
}
clear_buffer();
}



//This function initializes overall needed for wireless communication
void Setup_Mirf()
{
char Receive_Adr_Char[6];
char Send_Adr_Char[6];
Receive_Address.toCharArray(Receive_Adr_Char, 6);
Send_Address.toCharArray(Send_Adr_Char, 6);

Mirf.spi = &MirfHardwareSpi;
Mirf.init();
Mirf.setRADDR((byte *)Receive_Adr_Char);
Mirf.setTADDR((byte *)Send_Adr_Char);
Mirf.payload = sizeof(unsigned long);
Mirf.config();

//reg - Start
byte rf_setup = 0;
Mirf.readRegister( RF_SETUP, &rf_setup, sizeof(rf_setup) );

if (rf_setup != 0)
Serial.println("Beginning ... ");
else
{
Serial.println( "Wireless did not initialize!" );
while (rf_setup==0);
}
delay(100);
}

//This function clears the buffer
void clear_buffer ()
{
strMirfBuffer="";
}