0

I have connected my HC05 using TTL on my laptop.

Another side I have turn on my onboard bluetooth in Raspberry pi3.

I have python code for RPi3 communicate with my HC05.

Pairing is done using HC05 password

import serial
ser = serial.Serial("/dev/ttyS0", baudrate = 9600)
print ser.readline()

when I am checking board onboard bluetooth connection on RPi3 using dmesg | grep tty

smsc95xx.macaddr=B8:27:EB:AA:0D:73 bcm2708_fb.fbswap=1 bcm2709.uart_clock=48000000 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000  dwc_otg.lpm_enable=0 console=tty1 console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo

when I am running my code its waiting for response on long time at RPi3.

I don't receive any error ,but whatever data I am sending to RPi3 through HC05 on terminal ,RPI3 cant receive

socket based communication is better or serial port based communication on here

0

Finally I have tested with this code and Raspberry pi3 on board bluetooth receives data from HC05

from bluetooth import *
import time
bd_addr = "00:14:01:21:15:96"
port = 1
sock = BluetoothSocket (RFCOMM)
sock.connect((bd_addr,port))
print 'waiting'
while 1:
        data = sock.recv(10)
        print data
        time.sleep(2.0)
        #tosend = raw_input()
        #if tosend != 'q':
        #        sock.send(tosend)
        #else:
        #        break

sock.close()

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.