Seeed-Studio / ArduinoCore-samd

49 stars 27 forks source link

I2C slave #16

Closed Pillar1989 closed 3 years ago

Pillar1989 commented 4 years ago

https://forum.seeedstudio.com/t/communication-via-i2c-port-doesn-t-work/252696/6

jadonk commented 4 years ago

Any further updates on this?

turmary commented 4 years ago

The new branch i2c-slave works. Tested by code:

#include <Wire.h>

void setup() {
  Serial.begin(115200);
  /*
  pinMode(PIN_WIRE_SCL, INPUT_PULLUP);
  pinMode(PIN_WIRE_SDA, INPUT_PULLUP);
  */
  Wire.begin(0x08);
  Wire.onRequest(requestHandler);
  Serial.println("Setup complete");
}

void loop() {
  Serial.println(millis());
  delay(100);
}

void requestHandler() {
  Serial.println("Req: responding 4 bytes");
  Wire.write("ping  ");
}
Pillar1989 commented 4 years ago

Ping @jadonk

turmary commented 3 years ago

merged into master