device
Connection to device on I2C bus on Arduino or ESP32 hardware
Add-On Required: This feature requires the MATLAB Support Package for Arduino Hardware add-on.
Description
This object represents a connection to the I2C device on Arduino® or ESP32 hardware. Attach an I2C device to the appropriate pins on the Arduino or ESP32 hardware. You can interact with the I2C device using the functions listed in Object Functions.
Creation
Description
creates an object that represents the connection between an I2C peripheral connected to
the central Arduino or ESP32 hardware. The Arduino or ESP32 hardware is represented by an deviceObj
= device(arduinoObj
,'I2CAddress',I2CAddress
,Name,Value
)arduino
object.
You can also customize the connection further using one or more name-value pairs. The
'I2CAddress'
name-value pair is mandatory for creating the I2C device
connection.
Input Arguments
Properties
Object Functions
read | Read data from I2C bus |
readRegister | Read data from I2C device register |
write | Write data to I2C bus |
writeRegister | Write data to I2C device register |
Examples
More About
Version History
Introduced in R2019a