I'm trying to send a char [] through an NRF2401 but the radio.write () method always return 0. Check that msg contains the message read from str.
#define TAM 50
RF24 radio(9,10);
const uint64_t pipe = 0xE8E8F0F0E1AA;
char msg[TAM];
void setup() {
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(pipe);
}
void loop() {
if(Serial.available() > 0){
String str = Serial.readString();
str.toCharArray(msg,TAM);
if(!radio.write(msg, TAM)){
Serial.println("Message not send");
}
else
Serial.println(msg);
}
}
What am I doing wrong?
Edit1: What I have noticed, is that the first time I was allowed to send it but the others no longer.
Edit2: Remove the keyboard input by a char [] and sent it to without problems. Why can this be? Anything else happen when I make a keyboard entry?