I2C 设备
读取和写入连接到 Arduino® 硬件的 I2C 设备
在使用 I2C 函数之前,请使用 arduino
创建一个 Arduino 对象。有关详细信息,请参阅Connect to Arduino Hardware。您还可以使用 Arduino 资源管理器来配置 I2C 通信接口,并使用该接口对连接到 Arduino 硬件的 I2C 设备读取和写入数据。
注意
除了 scanI2CBus
之外,所有函数都可以使用 MATLAB Function 模块来生成代码。有关详细信息,请参阅Deploy Arduino Functions to Arduino Hardware Using MATLAB Function Block。
函数
device | Connection to device on I2C bus on Arduino or ESP32 hardware |
scanI2CBus | Scan I2C bus on Arduino hardware for device address |
read | Read data from I2C bus |
write | Write data to I2C bus |
readRegister | Read data from I2C device register |
writeRegister | Write data to I2C device register |
主题
- Communicate with an I2C EEPROM Device
Learn how to store and retrieve data from an I2C EEPROM device.
- Measure Temperature from I2C Device on Arduino Hardware
Learn how to measure temperature from an I2C device on your Arduino hardware.
- Arduino I2C Interface
Learn how Arduino hardware interfaces with the I2C protocol.