I am trying to use I2C to communicate between my XBee3 (controller) and an adafruit trinket m0. I'm pretty confident I have the modules connected properly (trinket SCL/pin 2 to xbee SCL/pin DIO1 & trinket SDA/pin 0 to xbee SDA/pin DIO11, and both grounds are connected). Here is my arduino code on the trinket:
Wire.begin(72); // join i2c bus
Wire.onReceive(receiveEvent); // register event
Serial.begin(9600); // start serial for output
Serial.print("Waiting for data...");
// function that executes whenever data is received from master
// this function is registered as an event, see setup()
void receiveEvent(int howMany)
(void)howMany; // avoid compiler warning about unused parameter
while(1 < Wire.available()) // loop through all but the last
char c = Wire.read(); // receive byte as a character
Serial.print(c); // print the character
int x = Wire.read(); // receive byte as an integer
Serial.println(x); // print the integer
and here is my code for the xbee (I'm using pycharm):
from machine import I2C
# Instantiate an I2C peripheral.
i2c = I2C(1)
slave_addr = 72
i2c.writeto(slave_addr, b'123', False)
The xbee throws this error on the i2c.writeto() line: OSError: [Errno 7110] ETIMEDOUT.
Any ideas what I'm doing wrong?