I'm currently workin on a project which consists of controlling a arduino robot ( with this https://www.adafruit.com/products/1588 bluetooth module on it ) from my raspberry pi.
I found this tutorial http://blog.dawnrobotics.co.uk/2013/11/talking-to-a-bluetooth-serial-module-with-a-raspberry-pi/ and followed it without problems ( i just had troubles pairing my devices but now it seem to be OK ;) ).
So i wrote a little piece of code ( i did not try the code in the tutorial ) to see if my robot was receiving order from my Pi but when i run this code, i get an error :
Traceback (most recent call last):
File "test.py", line 6, in <module>
bluetoothSerial.write("forward")
File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 485, in write
raise SerialException('write failed: %s' % (v,))
serial.serialutil.SerialException: write failed: [Errno 107] Transport endpoint is not connected
And here is the test code :
#! /usr/bin/python
import serial
import time
bluetoothSerial = serial.Serial( "/dev/rfcomm1", baudrate=9600 )
time.sleep(5)
bluetoothSerial.write( "forward") #Which normally make the robot go forward
Note that i'm able to connect to my arduino module using the command "sudo rfcomm connect hci0 XX:XX:XX:XX:XX:XX" which return me that i'm connected :
Connected /dev/rfcomm0 to 96:76:B6:00:2B:AD on channel 1
Press CTRL-C for hangup