When I write a test code for nrf module it's working , but when I trying to transmit the simple integer value '5421' it doesn't transmit and Arduino showing error
Welcome to the forum
I have moved your topic to the programming category of the forum
I wonder what data type are you using to hold the integer value 5421 ?
Please post your sketch, using code tags when you do
In my experience the easiest way to tidy up the code and add the code tags is as follows
Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.
Thanks for replying sir !
My code sketch is given below
#include <SPI.h>
#include <RF24.h>
// Create an RF24 object with CE and CSN pins
RF24 radio(0, 1);
// Define the address for communication
const byte address[] = "node";
// Data to be sent
int val = 5421 ;
void setup() {
// Start serial communication
Serial.begin(9600);
// Start radio communication
radio.begin();
// Set the radio to the writing mode and open a writing pipe
radio.openWritingPipe(address);
// Optionally set radio parameters here
radio.setPALevel(RF24_PA_HIGH); // Set the power level
radio.setDataRate(RF24_1MBPS); // Set the data rate
// Stop listening as we are only sending data
radio.stopListening();
}
void loop() {
// Send the data
bool success = radio.write(&val, sizeof(val));
if (success) {
// Data sent successfully
Serial.println("Data sent successfully");
} else {
// Data sending failed
Serial.println("Data send failed");
}
// Add a delay to avoid sending data too quickly
delay(1000);
}
Post an annotated schematic showing exactly how you have wired these. Be sure to show all power sources. How far apart are they?
RF24 radio(0, 1);
Which Arduino?
radio.setPALevel(RF24_PA_HIGH); // Set the power level
What is the distance (separation) between transmitter and receiver?
Don't you think it would be a good idea to provide the code for the receive side too???
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.