This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Why my gateway can only connect to the Xiaomi band 2,
#3
The Bluetooth adapter I use is CSR 4.0. I want to use it to connect other devices, such as CC2541 and CC2640. I can search for the Bluetooth of CC2541 and CC2640 in the BLE interface, but it just can't connect. The code I use is as follows. Hope to come to a big man to point me out, I have been troubled by this problem for a long time.

require('ble')
ble.up()
sock =ble.sock()
log(sock)
ble.settimeout(sock, 10)
res =ble.connect(sock,"78:04:73:BF:C4:E5",true)
log(res)
rbattery = ble.sockreadhnd(sock,0x47) or ''
battery = rbattery:byte(2)
rtime = ble.sockreadhnd(sock,45) or ''
time = {hour=rtime:byte(5), minute=rtime:byte(6), second=rtime:byte(7)}
log(rtime)
log(time)
log(rbattery)
log(battery)
rssi = ble.getrssi("78:04:73:BF:C4:E5")
log(rssi)
ble.close(sock)
Reply


Messages In This Thread
RE: Why my gateway can only connect to the Xiaomi band 2, - by 1114752670@qq.com - 03.04.2019, 12:31

Forum Jump: