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

#3525
Anonymous
Inactive

First, thank you for taking the time to respond.  I’ve looked at those links previously but will work with them again to read my array in from the SD card.  To deal with the second issue,  from what I can see in your code snippet, you are assigning the int the bulk values as I would expect, and it works properly locally.   However, using Easy Transfer, the array name switches from being arraydata[] to mydata.arraydata[], as per the Send_Data_Structure line declaration.  When trying to print my arraydata it works, but mydata.arraydata prints a different value.   Here is my code.  FYI, I’m running the latest Easy Transfer with Arduino 1.6.5 (for compatibility reasons with Teensy and SDFat).

#include <EasyTransfer.h>

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

 

//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[];

};

 

//give a name to the group of data

SEND_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(){

//this is how you access the variables. [name of the group].[variable name]

 

int arraydata[] = {0x000001,0x1000ff,0x10ff00,0x10ffff,0xff0001};

//send the data

ET.sendData();

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

 

for (uint8_t channel = 0; channel < LENGTH_OF_ARRAY(arraydata); channel++) {

Serial.print(“arraydata[“);

Serial.print(channel);

Serial.print(“]=”);

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

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

Serial.print(channel);

Serial.print(“]=”);

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

 

 

delay(1000);

}

}