无法通信:Arduino与蓝牙HC-06

无法通信:Arduino与蓝牙HC-06,arduino,Arduino,我写了一个程序,可以通过连接到Arduino Uno的DHT11传感器捕捉水分。捕获的值将通过蓝牙HC-06模块发送到Android应用程序。除了后者(HC-06)不发送捕获的水分外,其他一切正常 谁能帮帮我谢谢你吗 代码如下: #include <SoftwareSerial.h> /* to communicate with the Bluetooth module's TXD pin */ #define BT_SERIAL_TX 10 /* to communicate wi

我写了一个程序,可以通过连接到Arduino Uno的DHT11传感器捕捉水分。捕获的值将通过蓝牙HC-06模块发送到Android应用程序。除了后者(HC-06)不发送捕获的水分外,其他一切正常

谁能帮帮我谢谢你吗 代码如下:

#include <SoftwareSerial.h>
/* to communicate with the Bluetooth module's TXD pin */
#define BT_SERIAL_TX 10
/* to communicate with the Bluetooth module's RXD pin */
#define BT_SERIAL_RX 11
/* Initialise the software serial port */
SoftwareSerial BluetoothSerial(BT_SERIAL_RX, BT_SERIAL_TX);

// DHT-11 Configuration
#include <DHT.h> // lightweight DHT sensor library
#define DHTTYPE DHT11 // DHT 11
#define TEMPTYPE 0 // Use 0 for Celsius, 1 for Fahrenheit
#define DHTPIN 2
DHT dht(DHTPIN, DHTTYPE); // Define Temp Sensor

void setup() {
  BluetoothSerial.begin(115200); // Initialise BlueTooth
  Serial.begin(9600);
  //delay(1000);
  dht.begin(); // Initialize DHT Teperature Sensor
  BluetoothSerial.print("Starting ...");
}

void loop() {
  // Take readings
  float h = dht.readHumidity(); // Read humidity
  BluetoothSerial.println(h);
  delay(500);
}
#包括
/*与蓝牙模块的TXD引脚通信*/
#定义BT_串行_TX 10
/*与蓝牙模块的RXD引脚通信*/
#定义BT_串行_RX 11
/*初始化软件串行端口*/
软件串行蓝牙串行(BT_串行_RX、BT_串行_TX);
//DHT-11配置
#包括//轻型DHT传感器库
#定义DHT类型DHT11//DHT 11
#定义试探类型0//使用0表示摄氏度,1表示华氏度
#定义DHTPIN 2
DHT DHT(DHTPIN,DHT类型);//定义温度传感器
无效设置(){
BluetoothSerial.begin(115200);//初始化蓝牙
Serial.begin(9600);
//延迟(1000);
begin();//初始化dht温度传感器
BluetoothSerial.print(“开始…”);
}
void循环(){
//阅读
float h=dht.Read湿度();//读取湿度
BluetoothSerial.println(h);
延迟(500);
}