I am trying to establish serial communication between two Arduino's. I have been successful in getting a Mega to communicate with an Uno, however I cannot seem to get this library to work with the 101. Not sure what the issue is. Does this reflect a conflict based on the 101's Intel processor? I do not have enough savvy to troubleshoot this issue and am in desperate need of help. Can anyone offer some insight. Here is a representative sample of the code.
I would greatly appreciate any help anyone can offer. Thanks.
//////////////////////////////////Code running on the Mega//////////////////////////////////
#include <arduino2.h>
#include <elapsedMillis.h>
#include <avr/wdt.h>
#include <ExtendedADCShield.h>
#include <SPI.h>
#include <math.h>
#include <EasyTransfer.h>
EasyTransfer ETin1, ETout1;
struct SEND_DATA_STRUCTURE1
{
//put your variable definitions here for the data you want to receive
//THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
int infuseRateToPump;
int infuseRateFromPump;
};
struct RECEIVE_DATA_STRUCTURE1
{
//put your variable definitions here for the data you want to receive
//THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
int infuseRateToPump;
int infuseRateFromPump;
};
//give a name to the group of data
RECEIVE_DATA_STRUCTURE1 rxdata1;
SEND_DATA_STRUCTURE1 txdata1;
Int comdata = 0;
void setup()
{
Serial.begin(115200); // to communicate with the serial monitor
delay(1000);
Serial1.begin(115200); // to communicate with the Arduino 101
delay(100);
//start the library, pass in the data details and the name of the serial port.
ETin1.begin(details(rxdata1), &Serial1);
ETout1.begin(details(txdata1), &Serial1);
} //setup()
void loop()
{
if (Serial.available()>0) //
{
comdata = (Serial.parseInt());
txdata1.infuseRateToPump = comdata;
comdata = 0;
ETout1.sendData();
}
if(ETin1.receiveData())
{
Serial.println(rxdata1.infuseRateFromPump);
}
} //loop()
////////////////////////////////////Code running on the Arduino 101//////////////////////////////////
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include <math.h>
#include <EasyTransfer.h>
EasyTransfer ETin1, ETout1;
struct SEND_DATA_STRUCTURE1
{
//put your variable definitions here for the data you want to receive
//THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
int infuseRateToPump;
int infuseRateFromPump;
};
struct RECEIVE_DATA_STRUCTURE1
{
//put your variable definitions here for the data you want to receive
//THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
int infuseRateToPump;
int infuseRateFromPump;
};
//give a name to the group of data
RECEIVE_DATA_STRUCTURE1 rxdata1;
SEND_DATA_STRUCTURE1 txdata1;
void setup()
{
Serial.begin(115200); // to communicate with the serial monitor
delay(1000);
Serial1.begin(115200); // to communicate with the Arduino Mega
delay(100);
//start the library, pass in the data details and the name of the serial port.
ETin1.begin(details(rxdata1), &Serial1);
ETout1.begin(details(txdata1), &Serial1);
} //setup()
void loop()
{
if(ETin1.receiveData())
{
Serial.println(rxdata1.infuseRateToPump);
txdata1.infuseRateFromPump = rxdata1.infuseRateToPump;
ETout1.sendData();
}
} //loop()
]