connection problem
来源:互联网 发布:黑客模拟软件 编辑:程序博客网 时间:2024/05/17 23:40
Hello,
I'm trying to control my Arduino that has a HC-06 bluetooth connector on it from my Raspberry Pi 3 with the on board bluetooth. I need to send a character from the Raspberry Pi to the Arduino that will turn on a LED. Right now the Arduino code works and I can connect my computer to the HC-06 bluetooth connector and I'm able to turn the LED on and off. I was also able to connect my computer to the Raspberry Pi via bluetooth and even send a file between the two. But I'm not able to connect the Raspberry Pi to my Arduino with the HC-06 connector.
I get this error after trying to connect to it with bluetoothctl:
[CHG] Device 20:15:05:07:54:32 Connected: yes
Failed to connect: org.bluez.Error.NotAvailable
I've read up on a lot of info on how this can be done but it seems like my bluetooth version and the one in a tutorial are always different. I'm not sure what I'm missing but if you have any idea please let me know! Thank you all very much!!!
I'm trying to control my Arduino that has a HC-06 bluetooth connector on it from my Raspberry Pi 3 with the on board bluetooth. I need to send a character from the Raspberry Pi to the Arduino that will turn on a LED. Right now the Arduino code works and I can connect my computer to the HC-06 bluetooth connector and I'm able to turn the LED on and off. I was also able to connect my computer to the Raspberry Pi via bluetooth and even send a file between the two. But I'm not able to connect the Raspberry Pi to my Arduino with the HC-06 connector.
I get this error after trying to connect to it with bluetoothctl:
[CHG] Device 20:15:05:07:54:32 Connected: yes
Failed to connect: org.bluez.Error.NotAvailable
I've read up on a lot of info on how this can be done but it seems like my bluetooth version and the one in a tutorial are always different. I'm not sure what I'm missing but if you have any idea please let me know! Thank you all very much!!!
- Posts: 14
- Joined: Tue Oct 25, 2016 12:51 am
After a lot of search with trial and error I am at the same point! I do'nt get the file "/dev/rfcomm0". With the connect commad I get sthe same error message.
- Posts: 2
- Joined: Tue Oct 25, 2016 10:58 am
Yeah! We're probably missing something small which isn't allowing the on board bluetooth to read it. Are you trying to do the same thing with the Arduino and the HC-06 bluetooth connector? Because I'm also wondering if the Pi might have a hard time connecting to the HC-06. I know that some devices are unable to connect.
- Posts: 14
- Joined: Tue Oct 25, 2016 12:51 am
hc-06 works like a charm with the old blueZ and also with the new one
you only have to configure it properly (the old with the rfcomm.conf file, the new modifying the service file)
since it has been discussed many times on this forum, i leave you searching for the solution.
- Posts: 1514
- Joined: Fri May 02, 2014 1:52 pm
- Location: Italy
Here's a hint: https://www.raspberrypi.org/forums/view ... 85#p947185
- Posts: 3323
- Joined: Sat Mar 16, 2013 5:34 am
- Location: Chicago, IL
Yes I have seen this post and tried that before and I actually reinstalled Raspbian, updated and tried again. And I'm still running into the same problem.
I get this error after trying to connect to it with bluetoothctl:
[CHG] Device 20:15:05:07:54:32 Connected: yes
Failed to connect: org.bluez.Error.NotAvailable
- Posts: 14
- Joined: Tue Oct 25, 2016 12:51 am
Go to a terminal window and type 'bluetoothctl' then type 'scan on'. Does the Pi see the HC-06? Type 'info <bdaddr>'. What does it say? Quit bluetoothctl and enter 'sudo sdptool browse local'. Is the Serial Port Profile listed?
- Posts: 3323
- Joined: Sat Mar 16, 2013 5:34 am
- Location: Chicago, IL
Yes the Pi sees the HC-06. The info <bdaddr> returns: Device <bdaddr> not available. Yes the Serial Port Profile is listed.
- Posts: 14
- Joined: Tue Oct 25, 2016 12:51 am
Try the info command again, but replace '<bdaddr>' with the actual Bluetooth device address of the HC-06, for example:
- CODE: SELECT ALL
info AA:BB:CC:DD:EE:FF
- Posts: 3323
- Joined: Sat Mar 16, 2013 5:34 am
- Location: Chicago, IL
It says:
Name: HC-06
Alias: HC-06
Class 0x001f00
Paired: no
Trusted: yes
Blocked: no
connected: no
LegacyPairing: yes
- Posts: 14
- Joined: Tue Oct 25, 2016 12:51 am
OK. It needs to be paired before you can connect with it. In bluetoothctl, try to pair it:
- CODE: SELECT ALL
pair AA:BB:CC:DD:EE:FF
- CODE: SELECT ALL
trust AA:BB:CC:DD:EE:FF
- Posts: 3323
- Joined: Sat Mar 16, 2013 5:34 am
- Location: Chicago, IL
Alright so I paired it and it asked me for the key and I inputed it. It came up with the same error message I've been getting. But it nows says that the pairing is successful. I can still not connect to it.
- Posts: 14
- Joined: Tue Oct 25, 2016 12:51 am
How are you trying to connect? Use this rfcomm command:
- CODE: SELECT ALL
sudo rfcomm connect hci0 AA:BB:CC:DD:EE:FF
- Posts: 3323
- Joined: Sat Mar 16, 2013 5:34 am
- Location: Chicago, IL
YES! Now the HC-06 has its status light on full! I just need to figure out how to send the data that I want. Thank you very much this was extremely helpful!!!
- Posts: 14
- Joined: Tue Oct 25, 2016 12:51 am
You'll notice that you now have a /dev/rfcomm0 virtual serial device. You can use it with a serial terminal program such as minicom, or program to it with PySerial in Python or WiringPi in C.
- Posts: 3323
- Joined: Sat Mar 16, 2013 5:34 am
- Location: Chicago, IL
Yep! I was able to get it all to work and do what I needed it to do! Thank you very much!!!!
- Posts: 14
- Joined: Tue Oct 25, 2016 12:51 am
Many thanks to Douglas6 - my Bluetooth is working now with the HC-06!
- Posts: 2
- Joined: Tue Oct 25, 2016 10:58 am
Most welcome. It's nice to hear about the successes.
0 0
- connection problem
- mysql connection problem fix
- Wifi connection problem
- Oracle database connection problem
- connection problem or invalid MMI Code
- [Errno 14] problem making ssl connection问题解决
- docker 安装 problem making ssl connection
- The connection problem between MySQL and Eclipse
- YUM:[Errno 14] problem making ssl connection
- How To Solve The Problem : Unstable Ubuntu ADSL Connection
- [Jenkins] Upgrade to 2.7 causes connection refused problem
- Proxool Problem getting connection java.lang.IndexOutOfBoundsException(bug)
- yum [Errno 14] problem making ssl connection CentOs
- connection
- Connection
- Connection
- Connection
- Connection
- java系统高并发解决方案(转载)
- HDU 2088 Box of Bricks
- CentOS7:ifconfig command not found解决
- NFS服务安装配置(centos7 nfs-utils示例)
- 安卓复习之旅—Thread、Runnable、Callable、Futrue类关系与区别
- connection problem
- Mybatis 时间段查询 和 模糊查询
- php变量与JS变量直接交互不通过跳转
- Service、Thread的区别和使用
- PDF文件怎么添加图片 如何编辑PDF图片
- Opencv + C++转换mnist数据集文件为图像
- invalidate()和postInvalidate() 的区别及使用
- @Html.DropDownList 设置选中值无效
- VS之版本-获取编译时间-用于自动生成版本号