Page 1 of 1

<NULL> in serial command

Posted: 14 Jul 2021, 16:33
by Gerrit_001
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:

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
)

De only bytes that are send are 160 and 001.

Re: <NULL> in serial command

Posted: 15 Jul 2021, 07:45
by admin
The serial library probably internally uses null terminated strings so taking your first 0 as end of the string.
I'll try to check, maybe I could add function to send single byte...

Re: <NULL> in serial command

Posted: 15 Jul 2021, 11:50
by Gerrit_001
admin wrote:
15 Jul 2021, 07:45
The serial library probably internally uses null terminated strings so taking your first 0 as end of the string.
I'll try to check, maybe I could add function to send single byte...
If that's possible it would be greate!

Re: <NULL> in serial command

Posted: 22 Aug 2021, 11:35
by Gerrit_001
Did you found the time to look into this?

Re: <NULL> in serial command

Posted: 30 Aug 2021, 08:05
by admin
Not yet...