1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import bluetooth
import socket
import time
#from random import randint
bd_addr = "20:16:03:09:3A:E6"
port = 12
t=10
sock=bluetooth.BluetoothSocket( bluetooth.RFCOMM )
sock.connect((bd_addr, port))
trame_envoi_1= [127, 126, 128, 7, 0, 33, 0, 36, 1, 127, 229, 45]
def c():
sock.settimeout(t)
while 1:
print('debut')
try:
for i in trame_envoi_1:
sock.send(chr(i))
print(hex(i))
print('Trame_recue = ',trame_recue)
print (trame_recue[3])
except:
print('attend une trame')
break
c() |
Partager