I am a chinese. I am so sorry for my BAD English.
Maybe the program problem or the RF24 library problem.
In "while(wireloop==1)" then the 24l01 lost control.No autoack and listen.
I want my program can make a String.
Like this:
TX:Send "a"
RX:Receive "a"
TX:Send "r"
RX:Receive "r"
TX:Send "d"
RX:Receive "d"
TX:Send "u"
RX:Receive "u"
TX:Send "i"
RX:Receive "i"
TX:Send "n"
RX:Receive "n"
TX:Send "o"
RX:Receive "o"
TX:Send "|"(not "L".that is a comma.I want to make this mean END)
RX:Receive "|"(Make RX end.)
RX:Know that TX want to send a word "arduino".Sent in one by one way;
RX:Make a string.then print the string to serial
Here is the RX Program(Problem):
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
RF24 radio(9,10);
char wire;
String wireall;
unsigned long respone=123;
void setup()
{
Serial.begin(9600);
Serial.println(F("Test Begin"));
printf_begin();
radio.begin();
radio.setAutoAck(true);
radio.setRetries(15,15);
radio.setPALevel(RF24_PA_MIN);
radio.setDataRate(RF24_250KBPS);
radio.openReadingPipe(1,0xF0F0F0F00LL);
radio.openWritingPipe(0xF0F0F0F001LL);
radio.enableDynamicPayloads();
radio.startListening();
radio.printDetails();
}
void loop()
{
if(radio.available())
{
radio.read((char*)&wire,sizeof(char));
Serial.println(wire);
if(wire=='|')
{
char wire;
Serial.print("Get Start");
static boolean wireloop=1;
while(wireloop==1)
{
radio.startListening();
if(wire=='|')
{
break;
wireloop=0;
}
wireall+=wire;
if(radio.available())
{
radio.read((char*)&wire,sizeof(char));
}
}
Serial.print(wireall);
}
}
}
HERE is the TX Program(No problem at all):
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
#include "RF24_config.h"
RF24 radio(9,10);
char wire;
void setup()
{
Serial.begin(9600);
Serial.println(F("Test Begin"));
printf_begin();
radio.begin();
radio.setAutoAck(true);
radio.setRetries(15,15);
radio.setPALevel(RF24_PA_MIN);
radio.setDataRate(RF24_250KBPS);
radio.enableDynamicPayloads();
radio.powerDown();
radio.powerUp();
radio.openReadingPipe(1,0xF0F0F0F001LL);
radio.openWritingPipe(0xF0F0F0F00LL);
radio.startListening();
radio.printDetails();
}
void loop()
{
while(Serial.available()>0)
{
wire=Serial.read();
radio.stopListening();
bool ok=radio.write((char*)&wire,sizeof(char));
if (ok)
{printf("ok...");}
else
{ printf("failed.\n\r");
}
radio.startListening();
}
}
Thanks.