I am attempting to use an I2C bus with the EasyTransfer library. I am using the master read and slave write configuration using the Wire.onRequest function on the slave side. All that has happened so far is the processors froze up, they got stuck when it seemed they were transferring the data.
The code for the slave:
#include <Wire.h>
#include <EasyTransferI2C.h>
//create object
EasyTransferI2C ET;
struct RECEIVE_DATA_STRUCTURE{
int blinks;
int pause;
};
RECEIVE_DATA_STRUCTURE mydata;
void setup(){
Wire.begin(2);
ET.begin(details(mydata), &Wire);
Wire.onRequest(request);
}
void loop() {
}
void request() {
ET.sendData();
}
Code for the master:
#include <Wire.h>
#include <EasyTransferI2C.h>
EasyTransferI2C ET;
struct RECEIVE_DATA_STRUCTURE{
int blinks;
int pause;
};
Thankyou for any reply in advance!!
RECEIVE_DATA_STRUCTURE mydata;
void setup(){
Wire.begin(2);
ET.begin(details(mydata), &Wire);
Wire.onRequest(request);
}
void loop() {
}
void request() {
ET.sendData();
}