I'm trying to run this example scketch from the RF24 library, but it outputs gibberish in the terminal:
#include <SPI.h>
#include "RF24.h"
/****************** User Config ***************************/
/*** Set this radio as radio number 0 or 1 ***/
bool radioNumber = 0;
/* Hardware configuration: Set up nRF24L01 radio on SPI bus plus pins 7 & 8 */
RF24 radio(1,2);
/**********************************************************/
byte addresses[][6] = {"1Node","2Node"};
// Used to control whether this node is sending or receiving
bool role = 0;
void setup() {
Serial.begin(115200);
Serial.println(F("RF24/examples/GettingStarted"));
Serial.println(F("*** PRESS 'T' to begin transmitting to the other node"));
radio.begin();
// Set the PA Level low to prevent power supply related issues since this is a
// getting_started sketch, and the likelihood of close proximity of the devices. RF24_PA_MAX is default.
radio.setPALevel(RF24_PA_LOW);
// Open a writing and reading pipe on each radio, with opposite addresses
if(radioNumber){
radio.openWritingPipe(addresses[1]);
radio.openReadingPipe(1,addresses[0]);
}else{
radio.openWritingPipe(addresses[0]);
radio.openReadingPipe(1,addresses[1]);
}
// Start the radio listening for data
radio.startListening();
}
If I don't use the F() macro it works properly. I've read that it could be the microcontroller running out of memory, but it is not, here is the log:
Sketch uses 5,706 bytes (17%) of program storage space. Maximum is 32,256 bytes.
Global variables use 565 bytes (27%) of dynamic memory, leaving 1,483 bytes for local variables. Maximum is 2,048 bytes.
I also tried to test the F() macro using a simple scketch and it works well, the problem seems to happen only with this library.
Any thoughts? I really don't know what else to do.