hi
i want to send a array of data which is as long as 20 number with my NRF module
the data which should be send are stored in
int myArray1[20]={};
int myArray2[20]={};
there is two problem with this code
- is the coming data just count up to 16th one
- just one of arrays are received
please see the attached picture
any kindly help is appreciated
this is my Send section code
#include <SPI.h>
#include<nRF24L01.h>
#include<RF24.h>
#define CE_PIN 9
#define CSN_PIN 10
const uint64_t pipe=0xE8E8F0F0E1LL;
RF24 radio(CE_PIN,CSN_PIN);
int i;
int data[500];
int myArray1[20]={255,233,239,246,244,232,220,211,181,133,110,150,170,140,113,84,71,84,92,126};
int myArray2[20]={157,224,248,253,244,224,200,188,174,157,190,220,208,165,114,80,62,80,87,125};
void setup(){
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(pipe);
}
void loop(){
for (i = 0; i < 20; i = i + 1) {
data[i]=myArray1[i];
data[i]=myArray2[i];
radio.write(data,sizeof(data));
delay(5000);
}
}
this is my receive data
#include <SPI.h>
#include<nRF24L01.h>
#include<RF24.h>
#define CE_PIN 9
#define CSN_PIN 10
const uint64_t pipe=0xE8E8F0F0E1LL;
int i;
RF24 radio(CE_PIN,CSN_PIN);
int data[600];
void setup(){
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(1,pipe);
radio.startListening();
}
void loop(){
if (radio.available()){
Serial.println("data come ");
bool done=false;
while(!done)
{
for (i = 0; i < 25; i = i + 1) {
radio.read(data,sizeof(data));
Serial.print(i);
Serial.print(":");
Serial.print("DATA1:");Serial.print(data[i]);
Serial.print(",");
Serial.print("DATA2:");Serial.println(data[i]);
Serial.println("------------------------------");
if (i>18){
Serial.println("STOP");
}
delay(5000);
}
}
}
else {
Serial.println("No radio available");
delay(1000);
}
}