3

I have successfully paired the Pi 3 to an Android phone via bluetooth. I have tested an RFcomm channel connection using Bluetooth Terminal from the Play Store and it shows that I have a valid connection for data transport.

Now I simply want to view the data from a Python script. Very basic, just read from the port and print. Here's the code:

import serial

ser = serial.Serial('dev/rfcomm0', 9600)

while True:
    result = ser.read()
    print result

I get an error however when I run this code:

SerialException: could not open port dev/rfcomm0: [Errno 2] No such file or directory: 'dev/rfcomm0'

Anyone know how to fix this?

1

Like the error said, you have the wrong path. Did you missed / at first? /dev/rfcomm0?

Anyway, the bluetooth serial port of RPi 3 is on /dev/ttyAMA0, maybe you should try that first.

  • Yes, I had figured that out almost immediately after posting that I was simply missing the / .. Once I fixed that I easily could read incoming bits from the Bluetooth Terminal app. I didn't have to change the port. – Jammel Benjamin Jul 14 '16 at 21:23

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.