我正在使用一个传感器,它不断向arduino发送数字(读数) . 我也有一个BLE设备,并希望通过连接到我的手机的BLE_Shield发送它,我的问题是我的应用程序上的代码我不支持整数,所以我想知道,我怎么能将读数转换到一个字符串?

这是我的代码:

#include <Wire.h>
    #include <LIDARLite.h>
    #include <SoftwareSerial.h>


    LIDARLite myLidarLite;
    SoftwareSerial BLE_Shield(4,5);


    void setup()  // Called only once per startup
    {
    BLE_Shield.begin(9600);
    myLidarLite.begin(0, true);
    myLidarLite.configure(0);
    }

    void loop(){

    if(BLE_Shield.available()) {
        delay(750);
        BLE_Shield.write("Sensor:"+myLidarLite.distance());  //myLidarLite.distance() is the distance.
      }

当我使用它我的应用程序无法读取它,但当我用它替换它:

BLE_Shield.write("Sensor:123");

然后它成功收到 .