15.12.2016, 18:43
ok. I tried this:
function cmd (mioff)
-- edit ip address and port
ip = '192.168.1.32'
port = 5987
local sock = require('socket').udp()
if sock then
sockendto(cmd, ip, port)
sockettimeout(200)
data = sock:receive()
sock:close()
end
return data
end
log(data)
as event function I used this following:
require("user.milight")
mioff = string.char(0x31,0x00,0x00,0x00,0x03,0x04,0x00,0x00,0x00,0x01)
cmd (mioff)
But I received the error below:
User Library "Milight", Line 8: bad argument #1 to 'sendto' (string expected, got function).
Thanks.
function cmd (mioff)
-- edit ip address and port
ip = '192.168.1.32'
port = 5987
local sock = require('socket').udp()
if sock then
sockendto(cmd, ip, port)
sockettimeout(200)
data = sock:receive()
sock:close()
end
return data
end
log(data)
as event function I used this following:
require("user.milight")
mioff = string.char(0x31,0x00,0x00,0x00,0x03,0x04,0x00,0x00,0x00,0x01)
cmd (mioff)
But I received the error below:
User Library "Milight", Line 8: bad argument #1 to 'sendto' (string expected, got function).
Thanks.