And noticed your expertise in the setup of RF-nano's. I am working on similar issues, but I don't quite find an answer in these threads.
I have two RF nanos hooked up to my computer with a serial monitor, via usb.
I am using the regular Mirf scipts:
//Transmitter program
#include <SPI.h>
#include "Mirf.h"
#include "nRF24L01.h"
#include "MirfHardwareSpiDriver.h"
Nrf24l Mirf = Nrf24l(10, 9);
int value;
void setup()
{
Serial.begin(9600);
Mirf.spi = &MirfHardwareSpi;
Mirf.init();
//Set your own address (sender address) using 5 characters
Mirf.setRADDR((byte *)"ABCDE");
Mirf.payload = sizeof(value);
Mirf.channel = 90; //Set the channel used
Mirf.config();
}
void loop()
{
Mirf.setTADDR((byte *)"FGHIJ"); //Set the receiver address
value = random(255); //0-255 random number
Mirf.send((byte *)&value); //Send instructions, send random number value
Serial.print("Wait for sending.....");
while (Mirf.isSending()) delay(1); //Until you send successfully, exit the loop
Serial.print("Send success:");
Serial.println(value);
delay(1000);
}
//Receiver program
#include <SPI.h>
#include "Mirf.h"
#include "nRF24L01.h"
#include "MirfHardwareSpiDriver.h"
Nrf24l Mirf = Nrf24l(10, 9);
int value;
void setup()
{
Serial.begin(9600);
Mirf.spi = &MirfHardwareSpi;
Mirf.init();
Mirf.setRADDR((byte *)"FGHIJ"); //Set your own address (receiver address) using 5 characters
Mirf.payload = sizeof(value);
Mirf.channel = 90; //Set the used channel
Mirf.config();
Serial.println("Listening..."); //Start listening to received data
}
void loop()
{
if (Mirf.dataReady()) { //When the program is received, the received data is output from the serial port
Mirf.getData((byte *) &value);
Serial.print("Got data: ");
Serial.println(value);
}
}
My Emitter script is namely blocked at "Wait for sending..." , while the receiver finds "Got data: 0" (--> no data received).
(Also when i touch my D10 and D9 pins it does send "send value: x", but this value is not received in the receiving RF Nano)
I have no experience with the Mirf library. The examples in my Simple nRF24L01+ Tutorial use the TMRh20 RF24 library.
Wireless problems can be very difficult to debug so get the wireless part working on its own before you start adding any other features.
The examples are as simple as I could make them and they have worked for other Forum members. If you get stuck it will be easier to help with code that I am familiar with. Start by getting the first example to work
There is also a connection test program to check that the Arduino can talk to the nRF24 it is connected to. If the first example does not work be sure to try the connection test for both of your Arduinos. Nothing will work if the connection test fails.
A common problem with nRF24 modules is insufficient 3.3v current from the Arduino 3.3v pin. This seems to be a particular problem with the nano. The high-power nRF24s (with the external antenna) will definitely need an external power supply. At least for testing try powering the nRF24 with a pair of AA alkaline cells (3v) with the battery GND connected to the Arduino GND.
If you are using the high-power nRF24s (with the external antenna) it may help to have a distance of about 3 metres between the two nRF24s so that the signal does not overwhelm the receiver. However someone on the Forum has had them working without that separation - I don't have any personal experience with them. If you are new to nRF24s it may be better to start with a pair of low power modules with the pcb antenna.
Have you tried this thread? It may help you out. Also may I suggest that you try the connection test program that is towards the end of the tutorials that @Robin2 has provided. See his link in the previous post.
I tried a bunch of libraries and scripts, but it seems that your recent edit made the difference
EDIT 03 Feb 2021 - For this Tutorial install Version 1.1.7 of the RF24 library (available with the Arduino Library Manager). More information in Reply #30.
I am able to simple tranmit and receive between the two RF-nanos that were connected with usb to my laptop without additional external power.
Also solely using regular 9V batteries in the Vin&Gnd pins for power will do the trick when the scripts are already uploaded on the RF-nano.