Hi
I am having the issue where the receiveEvent function is not being called. I have replaced the default Arduino i2c library files with the Amebad files. So I don’t understand why the code doesn’t facilitate I2C communication.
#include "Wire.h"
byte I2C_OnOff; //defining the variable that will be sent
void setup()
{
Serial.begin(115200);
Wire.begin(0x3a); // Join I2C bus as the slave
}
void loop()
{
Serial.println("Check if Received....");
Wire.onReceive(receiveEvent);
delay(1000);
}
void receiveEvent(int Press)
{
Serial.println("Received!!");
I2C_OnOff = Wire.read(); // Reads the data sent via I2C
}
Thanks