![]()  | 
			|||
| HSG | 
		    
  | 
		
Konsole
mk@x2:~$ sudo /etc/init.d/bluetooth restart * Stopping bluetooth [ OK ] * Starting bluetooth [ OK ] mk@x2:~$ sudo rfcomm connect /dev/rfcomm0 00:16:53:00:68:6B 1 Connected /dev/rfcomm0 to 00:16:53:00:68:6B on channel 1 Press CTRL-C for hangup
Python
import serial
# Configure and open the port.
port = serial.Serial()
port.setPort('/dev/rfcomm0')
port.setBaudrate(9600)
port.setStopbits(1)
port.setByteSize(8)
port.setTimeout(5)
port.setParity('N')
port.open()
# Send FW Version request.
port.write(bytes([0x02,0x00,0x01,0x88]))
# Response expected is [7,0][2,88,0,?,?,?,?]
# sound mk 440hz, 1000ms ( 440 = 0xb8*1 + 0x01*256, 1000 = 0xe8*1 + 0x03*256 )
port.write(bytes([0x06,0x00,0x80,0x03,0xb8,0x01,0xe8,0x03]))
# keine Antwort ?
# Batterie ? mk
#port.write(bytes([0x02,0x00,0x00,0x0B]))
result = port.read(9)
print(result)
port.close()
Ausgabe
>>> b'\x07\x00\x02\x88\x00|\x01 \x01' >>> list(b'\x07\x00\x02\x88\x00|\x01 \x01') [7, 0, 2, 136, 0, 124, 1, 32, 1] >>>
