hennychen 发表于 2015-3-17 10:17:21

PlainProtocol write 通过蓝牙发送 接收端数据时而为null

#include <PlainProtocol.h>

PlainProtocol mytest(Serial, 57600);

const int waterPin = 10;

void setup() {
mytest.init();
pinMode(waterPin,INPUT);
}

void loop() {
int t_analogValue;//analog
t_analogValue = analogRead(0);   //connect Steam sensors to Analog 0
int t_digitalValue = LOW; //default digital low
t_digitalValue = digitalRead(waterPin);

//low is sending
if(t_digitalValue == LOW){
    mytest.write("T_A|T_D",t_analogValue,t_digitalValue);//send analogValue and digitalValue
}
delay(1000);
}

hennychen 发表于 2015-3-17 10:21:09

有时为乱码   我获取的16进制的

e01866fe 66000606 66fe6660 f818781e 18188600

hennychen 发表于 2015-3-17 11:33:22

mytest.sendFrame("T_A|T_D",2,t_analogValue,t_digitalValue);//send analogValue and digitalValue

解决方法
页: [1]
查看完整版本: PlainProtocol write 通过蓝牙发送 接收端数据时而为null