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.

Data buffering
#3
Resident script with sleep time 0, which send whatever data comes from clients and waits for 0.5 sec after each send.
Code:
if not server then
  -- local UDP server on port 5432
  server = require('socket').udp()
  server:settimeout(1)
  server:setsockname('127.0.0.1', 5432)

  -- serial connection
  port = require('serial').open('/dev/RS485', {
    baudrate = 4800,
    parity = 'odd',
    duplex = 'half',
    databits = 8,
    stopbits = 1
  })
end

cmd = server:receive()
if cmd then
  port:write(cmd)
  os.sleep(0.5)
end

Functiont to send data from event scripts.
Code:
function send(cmd)
  require('socket').udp():sendto(cmd, '127.0.0.1', 5432)
end
Reply


Messages In This Thread
Data buffering - by buuuudzik - 22.09.2016, 19:19
RE: Data buffering - by admin - 22.09.2016, 19:50
RE: Data buffering - by admin - 23.09.2016, 06:47
RE: Data buffering - by buuuudzik - 23.09.2016, 07:20
RE: Data buffering - by buuuudzik - 30.09.2016, 09:19
RE: Data buffering - by admin - 30.09.2016, 10:15
RE: Data buffering - by buuuudzik - 30.09.2016, 10:39
RE: Data buffering - by admin - 30.09.2016, 11:02
RE: Data buffering - by buuuudzik - 30.09.2016, 11:30
RE: Data buffering - by admin - 30.09.2016, 12:12
RE: Data buffering - by buuuudzik - 30.09.2016, 13:04

Forum Jump: