Author Options:

Raspberry Pi and arduino bluetooth module Answered

Hi there,

I'm currently workin on a project which consist of controlling a arduino robot ( with this [url]https://www.adafruit.com/products/1588[/url] bluetooth module on it ) from my raspberry pi.

I found this tutorial [url]http://blog.dawnrobotics.co.uk/2013/11/talking-to-a-bluetooth-serial-module-with-a-raspberry-pi/[/url] 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, there is an error :
[code]Traceback (most recent call last):
  File "test.py", line 6, in <module>
  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

Here is the code :
[code]#! /usr/bin/python

import serial
import time

bluetoothSerial = serial.Serial( "/dev/rfcomm1", baudrate=9600 )
bluetoothSerial.write( "forward") #Which normally make the robot go forward[/code]

Please help, It's been two days that I try to solve this problem  :cry:

PS: Sorry for my English ( i'm french and high school student)

Thanks :)


The forums are retiring in 2021 and are now closed for new topics and comments.

6 years ago

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


6 years ago

"avancer" in the error is "forward" in the code ( i just forgot to translate in english in the error ) and it's this word will be receive by the arduino to make the robot move ;)


6 years ago

I don't know but is "advancer" a command in French which is not understood by pi or an undefined function?