22 lines
440 B
Python
Executable File
22 lines
440 B
Python
Executable File
#!/usr/bin/python
|
|
|
|
#
|
|
# - Pair bluetooth useing bluetoothctl.
|
|
# agent on
|
|
# pair 20:16:02:14:58:51
|
|
# - Setup serial connection:
|
|
# sudo rfcomm bind hci0 20:16:02:14:58:51 1
|
|
#
|
|
# - For module
|
|
# sudo apt-get install python-serial
|
|
#
|
|
|
|
import serial
|
|
from time import sleep
|
|
|
|
bluetoothSerial = serial.Serial( "/dev/rfcomm0", baudrate=9600 )
|
|
|
|
bluetoothSerial.write( "Test from python." )
|
|
print bluetoothSerial.readline()
|
|
|