Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <Wire.h>
const byte addressSlave = 7;
int rxValue;
void setup()
{
Wire.begin(addressSlave);
Wire.onReceive(receiveEvent);
Serial.begin(115200);
}
void receiveEvent()
{
rxValue = Wire.read();
Serial.print("RX: "); Serial.println(rxValue);
}
void loop()
{
// Later millis() timed WLAN and MQTT code for publishing to AIO
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment