Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何使用蓝牙从arduino接收串行数据?_Android_Arduino_Bluetooth - Fatal编程技术网

Android 如何使用蓝牙从arduino接收串行数据?

Android 如何使用蓝牙从arduino接收串行数据?,android,arduino,bluetooth,Android,Arduino,Bluetooth,我是Arduino的新手,我对它有0点了解,而且这是我第一次使用蓝牙编码,因此我想问我如何才能从Arduino接收串行数据,例如,如何在我的android中更改文本视图: 我想从arduino获得这个值,并在我的android中更改textview。因此,它将类似于if(xxx==“11”){textview.setBackgroundColor(Color.RED);}但我不知道如何编写/如何获取arduino值并在android中声明。例如,您需要一个HC-05蓝牙模块,以及串行库的使用。

我是Arduino的新手,我对它有0点了解,而且这是我第一次使用蓝牙编码,因此我想问我如何才能从Arduino接收串行数据,例如,如何在我的android中更改文本视图:


我想从arduino获得这个值,并在我的android中更改textview。因此,它将类似于
if(xxx==“11”){textview.setBackgroundColor(Color.RED);}
但我不知道如何编写/如何获取arduino值并在android中声明。

例如,您需要一个HC-05蓝牙模块,以及串行库的使用。 尝试定义一个新的串行端口,然后通过它发送数据。 Arduino代码:

SoftwareSerial btSerial (12, 13); //TX sur 12 et RX sur 13
btSerial.begin(9600);
btSerial.println("Link Started !");

检查这个:我实际上在寻找我使用的arduino代码,等一下。我确实在你的问题下的第一条评论中添加了一个链接,它是用kotlin编写的,有你需要的一切。