Home Forums EasyTransfer Library Support Forum Easy Transfer Array Populating (from SD?) Reply To: Easy Transfer Array Populating (from SD?)

#3533
Anonymous
Inactive

Well, I’ve made some progress, but am still having difficulties.   I can get both units talking to one another, and the data on the sending side is properly being populated into the mydata.arraydata array.  However, when the data is being sent over to the receiving unit, it only populates XX amount of fields, then the rest of the array returns 0 values.   The unusual part is that if I have 250 values, it transfers the first 59 values and the rest are 0.  If I set it for 230 I get 43 values properly sent, etc etc.  There’s no rhyme or reason for the amount that properly send, that I can figure out.  Any ideas?

Here’s the TX code:

#include <EasyTransfer.h>

#define LENGTH_OF_ARRAY(x)((sizeof(x) / sizeof(x[0])))

File file;

//create object

EasyTransfer ET;

 

struct SEND_DATA_STRUCTURE {

//put your variable definitions here for the data you want to send

//THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO

int arraydata[13000];

};

 

//give a name to the group of data

SEND_DATA_STRUCTURE mydata;

 

void setup() {

Serial.begin(57600);

Serial1.begin(57600);

//start the library, pass in the data details and the name of the serial port. Can be Serial, Serial1, Serial2, etc.

ET.begin(details(mydata), &Serial1);

while (!Serial) {}  // wait for Leonardo

Serial.println(“Type any character to start”);

while (Serial.read() <= 0) {}

delay(400);  // catch Due reset problem

}

 

void loop() {

 

int arraydata[250] = { 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0xffffff, 0x00fffe, 0x00fffe, 0x000306, 0x00fffe, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0xffffff, 0x00fffe, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0xffffff, 0x00fffe, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0xffffff, 0x00fffe, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0xffffff, 0x00fffe, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0xffffff, 0x00fffe, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0xffffff, 0x00fffe, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0xffffff, 0x00fffe, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0xffffff, 0x00fffe, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0xffffff, 0x00fffe, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0xffffff, 0x00fffe, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0xffffff, 0x00fffe, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0xffffff, 0x00fffe, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0xffffff, 0x00fffe, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0xffffff, 0x00fffe, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0xffffff, 0x00fffe, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0xffffff, 0x00fffe, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0xffffff, 0x00fffe, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0xffffff, 0x00fffe, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0x00fffe, 0x000306, 0xffffff, 0x00fffe, 0xffffff};

memcpy(mydata.arraydata, arraydata, sizeof(arraydata));

//send the data

ET.sendData();

//print array data to serial monitor

for (uint16_t channel = 0; channel < LENGTH_OF_ARRAY(mydata.arraydata); channel++) {

Serial.print(“mydata.arraydata[“);

Serial.print(channel);

Serial.print(“]=”);

Serial.println(mydata.arraydata[channel], HEX);

delay(15);

}

 

Serial.print(“Iteration: “);

Serial.println(iter);

iter++;

}

 

The RX code:

#include <EasyTransfer.h>

#define LENGTH_OF_ARRAY(x)((sizeof(x) / sizeof(x[0])))

 

//create object

EasyTransfer ET;

 

struct RECEIVE_DATA_STRUCTURE {

//put your variable definitions here for the data you want to receive

//THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO

int arraydata[250];

};

 

//give a name to the group of data

RECEIVE_DATA_STRUCTURE mydata;

 

void setup() {

Serial1.begin(57600);

 

//start the library, pass in the data details and the name of the serial port. Can be Serial, Serial1, Serial2, etc.

ET.begin(details(mydata), &Serial1);

 

}

 

void loop() {

//check and see if a data packet has come in.

if (ET.receiveData()) {

for (uint16_t channel = 0; channel < LENGTH_OF_ARRAY(mydata.arraydata); channel++) {

Serial.print(“mydata.arraydata[“);

Serial.print(channel);

Serial.print(“]=”);

Serial.println(mydata.arraydata[channel], HEX);

delay(10);

}

 

}

 

//you should make this delay shorter then your transmit delay or else messages could be lost

//  delay(250);

}

—–

 

Thanks for taking a look.