Hello, I need help with my codes. So I'm building a communication system between 2 arduino uno using a nrf24l01+pa+lna on each arduino. For the initial step i have setup 2 system one for transmission and one for recieving. My main goal is for 2 way communication using these 2 systems and using encrypted morse code messages as source of transmission. The setup right now only consists of the nrf directly coneected to arduino uno.
Circuit pin connections of nrf on arduino uno:
GND - GND (digital pwm side)
VCC - 3.3V
CE - PIN D8
CSN - PIN D10
SCK - PIN D13
MOSI - PIN D11
MISO - PIN D12
I need help in understanding what is wrong with my current code and also need help in writing program for inserting a button, lcd with i2c display, led light to the circuit (if any other component necessary also to be added then what should they be). The lcd with i2c will be used for displaying of message, the button for dots and dashes of morse code, led lights for displaying if system is transmitting/recieving (active state) or idle (passive state). The led lights will be of 2 colour red and green for actvie and passive state.
Current code for transmitter:
#include <SPI.h>
#include <RF24.h>
RF24 radio(8, 10); // (CE, CSN)
const byte address[6] = "1RF24"; // address / identifier
void setup() {
Serial.begin(115200);
radio.begin();
radio.openWritingPipe(address); // set the address
radio.stopListening(); // set as transmitter
}
void loop() {
const char text[] = "Hi Receiver"; // max. 32 bytes
radio.write(&text, sizeof(text));
delay(2000);
}
Code for reciever:
#include <SPI.h>
#include "RF24.h"
RF24 radio(8, 10); // (CE, CSN)
const byte address[6] = "1RF24"; // address / identifier
void setup() {
Serial.begin(115200);
Serial.println("Start");
radio.begin();
radio.openReadingPipe(0,address); // set the address for pipe 0
radio.startListening(); // set as receiver
}
unsigned long count = 0;
unsigned long last = 0;
void loop() {
if(radio.available()){
char text[33] = {0};
radio.read(&text, sizeof(text)-1);
Serial.println(text);
}
count++;
if (millis()-last> 10000){
last = millis();
Serial.println(count);
count = 0;
}
}
The part of reciever code that will give me count on serial monitor was suggested by one professional from another forum.
The current issue is the message is not being transmitted.
The result outcome on the reciver seriel monitor:
Please help!
