Just installed the RH lib and am trying to run the examples (client/server). Running 2 UNO boards with 2 nRF24L01 (w/vr to 3.3). Standard wiring in all examples (8-CE, 10-CS, 13-SCK, etc)
Client appears to be not getting anything from the Server setup.
Swapped client code to other UNO/radio and moved Server....same results - Client appears to transmit but gets nothing from Server.
Need help trying to figure out what is not working...any help greatly appreciated...
See the "How to get the best out of this forum" post for hints.
Post your code, using code tags. You should not expect forum members to go searching for it, and to assume that you did not change anything. Most won't bother with links to videos.
Post a photo of the setup. Did you solder connections, and use antennas? Did you make the common mistake of using a breadboard with split rails?
Vcc & Gnd connected to 5v out on Uno.
That will burn out many of the NRF24 modules. Does yours have a built in 5V to 3.3V regulator? Post a link to the radio module.
Thanks for the input... new here so just getting my feet wet....
Server Code (from RadioHead Examples)
// rf24_server.pde
// -*- mode: C++ -*-
// Example sketch showing how to create a simple messageing server
// with the RH_RF24 class. RH_RF24 class does not provide for addressing or
// reliability, so you should only use RH_RF24 if you do not need the higher
// level messaging abilities.
// It is designed to work with the other example rf24_client
// Tested on Anarduino Mini http://www.anarduino.com/mini/ with RFM24W and RFM26W
#include <SPI.h>
#include <RH_RF24.h>
// Singleton instance of the radio driver
RH_RF24 rf24;
void setup()
{
Serial.begin(9600);
if (!rf24.init())
Serial.println("init failed");
// The default radio config is for 30MHz Xtal, 434MHz base freq 2GFSK 5kbps 10kHz deviation
// power setting 0x10
// If you want a different frequency mand or modulation scheme, you must generate a new
// radio config file as per the RH_RF24 module documentation and recompile
// You can change a few other things programatically:
//rf24.setFrequency(435.0); // Only within the same frequency band
//rf24.setTxPower(0x7f);
}
void loop()
{
if (rf24.available())
{
// Should be a message for us now
uint8_t buf[RH_RF24_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
if (rf24.recv(buf, &len))
{
// RF24::printBuffer("request: ", buf, len);
Serial.print("got request: ");
Serial.println((char*)buf);
// Serial.print("RSSI: ");
// Serial.println((uint8_t)rf24.lastRssi(), DEC);
// Send a reply
uint8_t data[] = "And hello back to you";
rf24.send(data, sizeof(data));
rf24.waitPacketSent();
Serial.println("Sent a reply");
}
else
{
Serial.println("recv failed");
}
}
}
Client Code (from RadioHead Examples)
// nrf24_client.pde
// -*- mode: C++ -*-
// Example sketch showing how to create a simple messageing client
// with the RH_NRF24 class. RH_NRF24 class does not provide for addressing or
// reliability, so you should only use RH_NRF24 if you do not need the higher
// level messaging abilities.
// It is designed to work with the other example nrf24_server.
// Tested on Uno with Sparkfun NRF25L01 module
// Tested on Anarduino Mini (http://www.anarduino.com/mini/) with RFM73 module
// Tested on Arduino Mega with Sparkfun WRL-00691 NRF25L01 module
#include <SPI.h>
#include <RH_NRF24.h>
// Singleton instance of the radio driver
RH_NRF24 nrf24;
// RH_NRF24 nrf24(8, 7); // use this to be electrically compatible with Mirf
// RH_NRF24 nrf24(8, 10);// For Leonardo, need explicit SS pin
// RH_NRF24 nrf24(8, 7); // For RFM73 on Anarduino Mini
void setup()
{
Serial.begin(9600);
while (!Serial)
; // wait for serial port to connect. Needed for Leonardo only
if (!nrf24.init())
Serial.println("init failed");
// Defaults after init are 2.402 GHz (channel 2), 2Mbps, 0dBm
if (!nrf24.setChannel(1))
Serial.println("setChannel failed");
if (!nrf24.setRF(RH_NRF24::DataRate2Mbps, RH_NRF24::TransmitPower0dBm))
Serial.println("setRF failed");
}
void loop()
{
Serial.println("Sending to nrf24_server");
// Send a message to nrf24_server
uint8_t data[] = "Hello World!";
nrf24.send(data, sizeof(data));
nrf24.waitPacketSent();
// Now wait for a reply
uint8_t buf[RH_NRF24_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
if (nrf24.waitAvailableTimeout(500))
{
// Should be a reply message for us now
if (nrf24.recv(buf, &len))
{
Serial.print("got reply: ");
Serial.println((char*)buf);
}
else
{
Serial.println("recv failed");
}
}
else
{
Serial.println("No reply, is nrf24_server running?");
}
delay(400);
}