Hello people,
Im very much new with arduino. I have tested arduino with nrf module for my project. I tested all the programs which available in internet but it is not working. Is it the problem with nRF module or do I need to do anything to activate the communication between the modules ?
.....
The programms I tested which is not working,
rx:
//Include Libraries
#include <nRF24L01.h>
#include <RF24.h>
//create an RF24 object
RF24 radio(9, 8); // CE, CSN
//address through which two modules communicate.
const byte address[6] = "00001";
void setup()
{
while (!Serial);
Serial.begin(9600);
radio.begin();
//set the address
radio.openReadingPipe(0, address);
//Set module as receiver
radio.startListening();
}
void loop()
{
//Read the data if available in buffer
if (radio.available())
{
char text[32] = {0};
radio.read(&text, sizeof(text));
Serial.println(text);
delay(1000);
}
}
tx :
//Include Libraries
#include <nRF24L01.h>
#include <RF24.h>
//create an RF24 object
RF24 radio(9, 8); // CE, CSN
//address through which two modules communicate.
const byte address[6] = "00001";
void setup()
{
radio.begin();
//set the address
radio.openWritingPipe(address);
//Set module as transmitter
radio.stopListening();
}
void loop()
{
//Send message to receiver
const char text[] = "Hello World";
radio.write(&text, sizeof(text));
delay(1000);
}.
But when I tested the nRF testing program , it was working, The working program was :
leader programm:
/*********************************************************************
** SPI-compatible **
** CE - to digital pin 9 **
** CSN - to digital pin 10 (SS pin) **
** SCK - to digital pin 13 (SCK pin) **
** MOSI - to digital pin 11 (MOSI pin) **
** MISO - to digital pin 12 (MISO pin) **
** IRQ - to digital pin 8 (MISO pin) **
*********************************************************************/
#include "NRF24L01.h"
#define TX_ADR_WIDTH 5 // 5 unsigned chars TX(RX) address width
#define TX_PLOAD_WIDTH 1 // 32 unsigned chars TX payload
unsigned char RX_ADDRESS[TX_ADR_WIDTH] =
{
0x34,0x43,0x10,0x10,0x01
};
int rx_buf = 0;
unsigned char tx_buf[TX_PLOAD_WIDTH] = {0};
void setup()
{
Serial.begin(9600);
NRF_Init(); // Initialize IO
NRF_SetRxMode();
Serial.println("RX_Mode start...");
}
void loop()
{
NRF_SetRxMode();
if(NRF_Receive)
{
Serial.print("RX = ");
Serial.print(rx_buf);
Serial.print(",");
}
delay(500);
}
follower:
#include "NRF24L01.h"
#define TX_ADR_WIDTH 5 // 5 unsigned chars TX(RX) address width
#define TX_PLOAD_WIDTH 1 // 3 unsigned chars TX payload
unsigned char TX_ADDRESS[TX_ADR_WIDTH] =
{
0x34,0x43,0x10,0x10,0x01
};
unsigned char rx_buf = {0}; // initialize value
int tx_buf = 10;
void setup()
{
Serial.begin(9600);
tx_buf= tx_buf+1;
NRF_Init(); // Initialize IO port
Serial.println("TX_Mode Start");
}
void loop()
{
NRF_SeTxMode();
do
{
NRF_Send(tx_buf);
}
while(!NRF_CheckAck());
}
Can someone help me with this issue ? Any help would be appreciable.

