Skip to content

Instantly share code, notes, and snippets.

@systembolaget
Created June 5, 2021 10:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save systembolaget/3452b28550eefbbf4a8c45f5cf69252d to your computer and use it in GitHub Desktop.
Save systembolaget/3452b28550eefbbf4a8c45f5cf69252d to your computer and use it in GitHub Desktop.
#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