Last active
January 30, 2023 19:42
-
-
Save kevindoran/5428623 to your computer and use it in GitHub Desktop.
A simple Python script to send messages to a sever over Bluetooth using PyBluez (with Python 2).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A simple Python script to send messages to a sever over Bluetooth | |
using PyBluez (with Python 2). | |
""" | |
import bluetooth | |
serverMACAddress = '00:1f:e1:dd:08:3d' | |
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() |
from bluetooth import *
serverMACAddress = '00:1f:e1:dd:08:3d'
port = 3
s = BluetoothSocket(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()
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I get an error:
AttributeError: 'module' object has no attribute 'BluetoothSocket'
. thanks!