<NULL> in serial command
Posted: 14 Jul 2021, 16:33
Hello! I hope somebody can help me with this one.
I want to activate a present on a device (PTZ camera) with a serial command (RS232).
I can send ASCII string but the device needs a specific serial command.
The problem is that when the value <NULL> is send the <NULL> isn’t send and also other consecutive bytes after the <NULL>.
Does anybody know a work around?
The code:
De only bytes that are send are 160 and 001.
I want to activate a present on a device (PTZ camera) with a serial command (RS232).
I can send ASCII string but the device needs a specific serial command.
The problem is that when the value <NULL> is send the <NULL> isn’t send and also other consecutive bytes after the <NULL>.
Does anybody know a work around?
The code:
Code: Select all
lmc_device_set_name('KEYBOARD','29020817')
lmc_add_com('C4', 'COM4')
lmc_print_devices()
Preset01 = string.char(160,1,0,7,0,1,175,8)
lmc_set_handler('C4',function(comVal)
if (comVal == Preset01) then
print('Preset 1 activated on another device')
end
end
)
lmc_set_handler('KEYBOARD', function(button,direction)
if (direction == 0) then return end
if (button == 67) then
lmc_send_to_com('C4', Preset01)
else print('Key to assign: ' .. button)
end
end
)