[英]How can I use serial communication (port) via Android Bluetooth to send data?
How can I use serial communication (port) via Bluetooth to send data? 如何通过蓝牙使用串行通信(端口)发送数据?
I need to send serial data through an Android device to a Bluetooth model (BlueSMiRF Silver) (that is connected to an Arduino board). 我需要通过Android设备将串行数据发送到蓝牙模型(BlueSMiRF Silver)(已连接到Arduino板)。
I was literally sitting for three day trying to understand how to do that... 我实际上坐了三天,试图了解如何做到这一点。
Would be nice to have more details about what you tried and where you are stuck. 将是不错的有关于你尝试过什么,你在哪里停留更多的细节。
On the Android side the first step is to pair with the BlueSMiRF module. 在Android方面,第一步是与BlueSMiRF模块配对。 You should be able to discover the BlueSMiRF and pair from the "Bluetooth Settings" on android.
您应该能够在Android的“蓝牙设置”中发现BlueSMiRF并进行配对。 You might have to put the BlueSMiRF module in discoverable mode (and you can set the a pin code for it).
您可能必须将BlueSMiRF模块置于可发现模式(并且可以为其设置密码)。
Once paired, to be able to send and receive data you need to connect using a Bluetooth socket. 配对后,为了能够发送和接收数据,您需要使用蓝牙插座进行连接。 To communicate with the BlueSMiRF module you need to use the Serial Port Profile (SPP) and create and RFCOMM socket.
要与BlueSMiRF模块通信,您需要使用串行端口配置文件(SPP)并创建一个RFCOMM套接字。 For an example you can have a look at this post .
例如,您可以看一下这篇文章 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.