【发布时间】:2014-07-01 13:34:21
【问题描述】:
这是我的问题。我在我的电脑(Windows 7)上有一个通过 USB 连接的 Arduino Mega 2560。在 arduino 上,我连接了一个蓝牙设备 HC-06。我将以下程序上传到我的 arduino:
#include <SoftwareSerial.h>// import the serial library
SoftwareSerial Genotronex(14, 15); // RX, TX
int BluetoothData; // the data given from Computer
void setup() {
// put your setup code here, to run once:
Genotronex.begin(9600);
}
void loop() {
BluetoothData=Genotronex.read(); //read incoming data
Genotronex.println(BluetoothData); //print data received from bluetooth
delay(100);// prepare for next data ...
}
我已成功将我的 arduino 与蓝牙连接。接下来我使用腻子并连接到蓝牙,但问题是它打印“-1”意味着蓝牙的传入数据是“-1”,尽管我没有从任何其他程序发送任何数据。我也尝试从腻子发送其他数据,但它没有用。感谢并为我的英语感到抱歉。
【问题讨论】: