bluetooth
说明
bluetooth
对象表示使用 Bluetooth® 串行端口配置文件 (SPP) 从您的计算机到 Bluetooth 经典设备的连接。通过 bluetoothlist
输出中的 "Ready to connect"
状态确定附近要连接到的设备。在从 MATLAB® 连接到设备之前,您必须先将设备与您的计算机配对。
创建对象
语法
说明
创建与最后一个成功连接的 Bluetooth 经典设备的连接。device
= bluetooth
使用其名称创建与 Bluetooth 经典设备的连接。通道是默认的 SPP 通道 1。输入 device
= bluetooth(name
)name
设置 Name
属性。
创建到 Bluetooth 经典设备的指定 SPP 通道 device
= bluetooth(name
,channel
)channel
的连接。输入 channel
设置 Channel
属性。
使用其地址创建到 Bluetooth 经典设备的连接。输入 device
= bluetooth(address
)address
设置 Address
属性。
创建到 Bluetooth 经典设备的指定 SPP 通道 device
= bluetooth(address
,channel
)channel
的连接。
属性
对象函数
read | 从 Bluetooth 设备读取数据 |
readline | 从 Bluetooth 设备读取 ASCII 字符串数据行 |
write | 将数据写入 Bluetooth 设备 |
writeline | 将 ASCII 数据行写入 Bluetooth 设备 |
configureTerminator | 为与 Bluetooth 设备的 ASCII 字符串通信设置终止符 |
configureCallback | 为与 Bluetooth 设备的通信设置回调函数和触发条件 |
flush | 清空 Bluetooth 设备缓冲区 |
示例
版本历史记录
在 R2020b 中推出