1

I have successfully connected my cell phone to the Raspberry Pi's onboard Bluetooth. I know the Bluetooth works, but I cannot get connection on Bluetooth to work properly.

I get this error when I run the script:

Traceback (most recent call last): File
"/home/pi/Desktop/bluetest.py", line 34, in <module>
s.connect((serverMACAddress, port)) File "", line 5, in connect BluetoothError: (111, 'Connection refused')

How do I fix this, or what do I need to do to make this work?

import bluetooth
from bluetooth import *

serverMACAddress = '00:13:EF:C0:02:1E'
port = 3
s = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
s.connect((serverMACAddress, port))
while 1:
     text = raw_input() # Note change to the old (Python 2) raw_input
     if text == "quit":
         break
     s.send(text)
sock.close()
| improve this question | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.