Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bluetooth
- bd_addr = “INSERT MODULE MAC ADDRESS”
- port = 1
- print “creating socket”
- sock=bluetooth.BluetoothSocket( bluetooth.RFCOMM )
- print “connecting: “+bd_addr+”:”+str(port)
- sock.connect((bd_addr, port))
- print “sending string”
- sock.send(“led”)
- print “waiting for answer”
- buff = “”
- while(buff != “OK” and buff != “ERROR”):
- buff += sock.recv(1)
- print buff
- print “closing socket”
- sock.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement