Arduino I2C:Wire.endTransmission() 在 Wire.requestFrom() 之前还是之后?
在 Arduino 中调用 Wire 命令的正确顺序是:
i2c_wire_example.ino
Wire.beginTransmission(MY_I2C_ADDR);
Wire.write(addr);
Wire.endTransmission();
Wire.requestFrom(MY_I2C_ADDR, 1); // 请求一个字节
delay(5); // 等待数据可用
uint8_t value = Wire.read();所以你在 Wire.write() 之后调用 Wire.endTransmission(),并在 Wire.endTransmission() 之后直接调用 Wire.requestFrom()
Check out similar posts by category:
Arduino, Electronics, Embedded, PlatformIO
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow