文档帮助中心文档
从I2C设备寄存器读取数据
= readRegister (dev,注册)
= readRegister (dev、登记、精密)
例子
出= readRegister (dev,注册)返回从I2C设备寄存器读取的数据。
出= readRegister (dev,注册)
出
dev
注册
出= readRegister (dev,注册,精度)还指定数据精度。
出= readRegister (dev,注册,精度)
精度
全部折叠
创建一个Arduino对象并将一个I2C设备对象附加到它。
一个= arduino (“COM9”,“Uno”,“库”,“I2C”);
使用地址创建I2C设备连接。
dev =设备(,“I2CAddress”,“0 x55”)
dev = device with properties: Interface: 'I2C' I2CAddress: 85 ('0x55') Bus: 0 SCLPin: 'A5' SDAPin: 'A4' BitRate: 100000 (bits/s)显示功能
将值10写入地址20的I2C设备寄存器。
writeRegister (dev、20、10);
从地址20的I2C设备寄存器中读取。
值= readRegister (dev, 20)
值= 10
dev =设备(,“I2CAddress”,“0 x54”);
将值224写入地址为20的I2C设备寄存器,精度为uint16
224年writeRegister (dev, 20日,“uint16”);
从地址20的I2C设备寄存器中以uint16的精度读取。
值= readRegister (dev 20“uint16”)
值= 224
I2C设备连接,指定为设备对象。
设备
I2C设备寄存器的地址,指定为从0到255的标量整数、十六进制或二进制。
“uint8”
“int8”
“uint16”
“int16”
“uint32”
“int32”
“uint64”
“int64”
数据精度,指定为以下字符向量之一:
存储在I2C设备寄存器中的数据的值,返回为标量或向量基于精度.
标量
向量
使用readRegister在MATLAB®函数块万博1manbetx®万博1manbetxArduino支持包®硬件生成可以部署在Arduino硬件上的代码。
readRegister
arduino|读|写|writeRegister
arduino
读
写
writeRegister
您有这个示例的一个修改版本。要用编辑打开这个例子吗?
您点击了一个对应于这个MATLAB命令的链接:
通过在MATLAB命令窗口中输入该命令来运行该命令。Web浏览器不支持MATLAB命令。万博1manbetx
选择一个网站来获得可用的翻译内容,并看到当地的活动和提供。根据您所在的位置,我们建议您选择:.
你也可以从以下列表中选择一个网站:
请选择表现最佳的中国网站(中文或英文)。MathWorks的其他国家网站并没有针对您所在位置的访问进行优化。
与当地办事处联系