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.

BLE profiles
#10
(21.04.2020, 06:23)admin Wrote: This line is incorrect (only 0xA0 is assigned to cmd):
Code:
cmd = 0xA0, 0x1F

Thanks, i have it working correctly now (in resident script with 0 delay) and returning the correct values as below, 
but if i put a longer delay than 0 on the resident script the correct values are not returned,

what could be the reason for this?
how should this code run, in a ble profile? or it is ok in resident script?
also i want to only ask this device what its values are every 15 min or so, as it is a battery operated device... 
should i do a scheduled script every x minutes?

Code:
require('ble')
sock = ble.sock()
ble.settimeout(sock, 10)
res = ble.connect(sock, "80:EA:CA:89:1D:78")
if res then
  cmd1, cmd2 = 0xA0, 0x1F
  x, err =  ble.sockwritereq(sock, 0x33, cmd1, cmd2)
log(x, err)

rx = ble.sockreadhnd(sock, 0x35)
loghex(rx)
temperature = (rx:byte(2) + rx:byte(1)) / 10
log(temperature)
end
Reply


Messages In This Thread
BLE profiles - by morak - 29.01.2018, 11:37
RE: BLE profiles - by 1114752670@qq.com - 13.03.2019, 07:53
RE: BLE profiles - by Daniel - 13.03.2019, 08:48
RE: BLE profiles - by gjniewenhuijse - 13.03.2019, 11:06
RE: BLE profiles - by admin - 13.03.2019, 11:19
RE: BLE profiles - by benanderson_475 - 13.01.2020, 21:17
RE: BLE profiles - by admin - 14.01.2020, 07:44
RE: BLE profiles - by benanderson_475 - 21.04.2020, 01:00
RE: BLE profiles - by admin - 21.04.2020, 06:23
RE: BLE profiles - by benanderson_475 - 22.04.2020, 00:38
RE: BLE profiles - by admin - 22.04.2020, 10:53
RE: BLE profiles - by benanderson_475 - 12.03.2022, 10:12

Forum Jump: