首页 > 解决方案 > 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(() {});
  }

标签: flutterbluetoothbluetooth-lowenergy

解决方案


推荐阅读