Been working on getting a nano to talk via the nRF24 and been coming across a strange issue. After some searching, I thought I would ask here as I have not seen a solution to my exact problem.
If, I upload my sketch with no radio commands, IE: radio.write or radio.read, the nano works fine. It reports and Serial prints the state of the buttons and runs loop after loop.
As soon as I put in a radio command, it starts 1 loop and as soon as it gets to the radio command it locks up. It may run 1 full loop, but never more than 2... unless... I touch the D12 MISO pin. Then it will run several loops and fail again. I touch the pin, and it takes off for 20 or so more loops.
It will do this with or with out the radio wired to the nano. I have 4 nanos, and all behave the same.
Could a capacitor across 3.3V and Gnd solve my problem?
Here is my sketch incase I am missing something... very possible.
#include <nRF24L01.h>
#include <printf.h>
#include <RF24.h>
#include <RF24_config.h>
RF24 radio (9, 10); // CE, CSN
const byte address[6] = "00001";
String ident = "Radio 1";
int testButton (4);
int testButtonstate;
int resetButton (5);
int resetButtonstate;
int ledRe (7);
int runCounter;
void setup() {
pinMode (testButton, INPUT);
pinMode (resetButton, INPUT);
pinMode (ledRe, OUTPUT);
Serial.begin(9600);
Serial.println("Ready");
radio.begin();
radio.openWritingPipe (address);//00001
radio.setPALevel (RF24_PA_MIN);
radio.stopListening();
Serial.println("Radio Ready");
}
void loop() {
runCounter++;
Serial.println(runCounter);
testButtonstate = digitalRead(testButton);
resetButtonstate = digitalRead(resetButton);
Serial.print("Test "); Serial.println(testButtonstate);
Serial.print("Reset "); Serial.println(resetButtonstate);
//Radio sending
radio.write(&ident, sizeof(ident));
delay(10);
Serial.print("Ident Sent......");
radio.write(&resetButtonstate, sizeof(resetButtonstate));
delay(10);
Serial.println("Reset Sent.....");
}



