Home › Forums › EasyTransfer Library Support Forum › Easy Transfer Byte Limit? › Reply To: Easy Transfer Byte Limit?
y dis serial print is not working.. :/
#include <Wire.h>
#include <EasyTransferI2C.h>
const int num = 12;
int print_buffer[num];
//create object
EasyTransferI2C 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 DATA_ID;
int DATA1;
int DATA2;
int DATA3;
int DATA4;
int DATA5;
int DATA6;
int DATA7;
int DATA8;
int DATA9;
int DATA10;
int DATA11;
int DATA12;
int DATA13;
};
//give a name to the group of data
RECEIVE_DATA_STRUCTURE sensor_data;
//define slave i2c address
#define I2C_SLAVE_ADDRESS 9
void setup(){
Serial.begin(9600);
Wire.begin(I2C_SLAVE_ADDRESS);
//start the library, pass in the data details and the name of the serial port. Can be Serial, Serial1, Serial2, etc.
ET.begin(details(sensor_data), &Wire);
//define handler function on receiving data
Wire.onReceive(receive);
}
void loop()
{
//check and see if a data packet has come in.
if(ET.receiveData())
{
if (sensor_data.DATA_ID == 1)
{
print_buffer[0] = sensor_data.DATA1;
print_buffer[1] = sensor_data.DATA2;
print_buffer[2] = sensor_data.DATA3;
print_buffer[3] = sensor_data.DATA4;
print_buffer[4] = sensor_data.DATA5;
print_buffer[5] = sensor_data.DATA6;
print_buffer[6] = sensor_data.DATA7;
print_buffer[7] = sensor_data.DATA8;
print_buffer[8] = sensor_data.DATA9;
print_buffer[9] = sensor_data.DATA10;
print_buffer[10] = sensor_data.DATA11;
print_buffer[11] = sensor_data.DATA12;
print_buffer[12] = sensor_data.DATA13;
/*Serial.print(“DATA1”);
Serial.println(sensor_data.DATA1);
Serial.print(“DATA2”);
Serial.println(sensor_data.DATA2);
Serial.print(“DATA3”);
Serial.println(sensor_data.DATA3);
Serial.print(“DATA4”);
Serial.println(sensor_data.DATA4);
Serial.print(“DATA5”);
Serial.println(sensor_data.DATA5);
Serial.print(“DATA6”);
Serial.println(sensor_data.DATA6);
Serial.print(“DATA7”);
Serial.println(sensor_data.DATA7);
Serial.print(“DATA8”);
Serial.println(sensor_data.DATA8);
Serial.print(“DATA9”);
Serial.println(sensor_data.DATA9);
Serial.print(“DATA10”);
Serial.println(sensor_data.DATA10);
Serial.print(“DATA11”);
Serial.println(sensor_data.DATA11);
Serial.print(“DATA12”);
Serial.println(sensor_data.DATA12);
Serial.print(“DATA13”);
Serial.println(sensor_data.DATA13);
// delay(100);*/
for(int i=0;i<=num;i++)
{
if(i == num)
Serial.println(print_buffer[i]);
else
{
Serial.print(print_buffer[i]);
Serial.print(‘\t’);
}
}
}
}
}
void receive(int numBytes) {}