Skip to content

moteus/lua-lluv-rs232

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

lua-lluv-rs232

Usage

local uv = require "lluv"
uv.rs232 = require "lluv.rs232"

local port = uv.rs232('COM3',{
  baud         = '_9600';
  data_bits    = '_8';
  parity       = 'NONE';
  stop_bits    = '_1';
  flow_control = 'OFF';
  rts          = 'ON';
})

port:open(function(self, err, data)
  if err then
    print("Port open error:", err)
    return self:close()
  end

  self:start_read(function(self, err, data)
    if err then
      print("Port read error:", err)
      return self:close()
    end
    io.write(data)
  end)

  port:write('AT\r\n')
end)

uv.run()

About

Serial port communication library for lluv library

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages