-
Notifications
You must be signed in to change notification settings - Fork 0
I2C
Harpo edited this page Oct 2, 2019
·
1 revision
For performances and mission critical transmissions, I2C is more reliable than Serial and should be preferred.
Simplified example (from dmx/dmx.ino)
#define DMX_CHANNELS 5
// {PROGRAM, R, G, B, SPEED}
const byte I2C_ADDRESS = 42;
uint8_t DMX_PACKET[DMX_CHANNELS];
void sendPacket() {
Wire.beginTransmission(I2C_ADDRESS);
Wire.write(DMX_PACKET, DMX_CHANNELS);
while (Wire.endTransmission()) {
}
}
void loop() {
readDMX();
if (NEWS) {
sendPacket();
}
}