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?

Ghanima
16k17 gold badges66 silver badges127 bronze badges
asked Jul 12, 2016 at 16:32

1 Answer 1

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.

answered Jul 12, 2016 at 18:28
1
  • 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. Commented Jul 14, 2016 at 21:23

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.