flutter - Flutter 蓝牙 BLE 读取和中断
问题描述
目前我正在尝试使用 MLT-BT05 与 Arduino 进行通信。我已经设法将字符串发送到 arduino,但我无法读取任何值。我已经尝试阅读具有各种特征但注意到作品的每项服务。有谁
知道如何读取这些字符串?(哪个服务)我的第二个问题是,如果将值发送到手机,是否可以编写某种中断。顺便说一句,我正在使用 flutter_blue 库。感谢您的回答!
我的阅读代码:
read() async {
while (true) {
for (BluetoothCharacteristic c in _services[3].characteristics) {//the 3 is just an example I tried every index
List<int> value = await c.read();
String valuestring = new String.fromCharCodes(value);
print(valuestring);
}
}
//setState(() {});
}
解决方案
推荐阅读
- angular - 除非触发另一个错误,否则 Angular 表单交叉验证错误消息不会显示在视图中
- android - Android Room Insert 不插入也不做任何事情
- php - 使用 PHP printf 和 sprintf 函数在文本字符串中输出动态电子邮件 mailto 链接
- assembly - 递归斐波那契 NASM
- pytorch - 将 pytorch 转换为 CoreML 时可以控制输出吗?
- git - Git 中的所有内容都显示为“新文件”
- html - #icon:hover + #text 过渡 for + #text 部分
- android - 如何在 Jetpack Compose 中为 NavigationDrawer 设置宽度和高度
- excel - ExportasFixedformat 在 900 次运行期间抛出错误 1004 一到五次
- go - 为什么 -2 和 -1 在 Go 中等于 -2?