22 lines
442 B
Python
22 lines
442 B
Python
#!/usr/bin/python
|
|
import bluetooth
|
|
import sys
|
|
import time
|
|
|
|
|
|
bd_addr = "98:D3:31:B2:35:33" #itade address
|
|
|
|
port = 1
|
|
sockTerm=bluetooth.BluetoothSocket( bluetooth.RFCOMM )
|
|
sockTerm.connect((bd_addr, port))
|
|
print 'Connected'
|
|
sockTerm.settimeout(1.0)
|
|
print sys.argv[1]
|
|
sockTerm.send(sys.argv[1])
|
|
print 'Sent data'
|
|
time.sleep(5) # delays for 5 seconds
|
|
data = sockTerm.recv(1024)
|
|
print 'received [%s]' % data
|
|
sockTerm.close()
|
|
print 'socket chius'
|
|
|