我在Arduino做一个项目,并希望在我的Android传感器数据。为此,我在Android上使用HC-05 BT模块和蓝牙终端应用程序。但是蓝牙终端正在以恒定的速率接收数据(我想是1秒)。我想接收10毫秒的数据。我该怎么做呢?
下面是我的代码:
#include <SoftwareSerial.h>
int RX=0;
int TX=1;
SoftwareSerial Bluetooth(RX,TX);
int i=0;
void setup() {
Bluetooth.begin(9600);
Bluetooth.println("The controller has successfuly connected to the phone");
}
void loop() {
Bluetooth.write(i);
i++;
delay(5);
}发布于 2016-04-20 02:14:25
如果它是完整的代码,那么您发送的是未打印的字符。而且,在你得到i=127后,你将从ascii表的上部发送字符。想一想当i>255。在循环中尝试以下代码:
Bluetooth.println("this is test code")
而不是编写Bluetooth.write(i);
您可以获得有关ASCII 以及Serial.print和Serial.write的更多信息
https://stackoverflow.com/questions/36722656
复制相似问题