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.

1-wire keyfob and reader
#10
You can use this function to list devices on a certain 1-Wire bus:
Code:
require('ow')

function list(bus)
  local res = {}
  local dir = ow.dir('/uncached/bus.' .. bus) or {}
  for _, entry in ipairs(dir) do
    local chunks = entry:split('/')
    if #chunks == 4 and chunks[ 4 ]:match('^%x%x%.') then
      res[ #res + 1 ] = chunks[ 4 ]
    end
  end

  return res
end

log(list(0))
log(list(1))
Reply


Messages In This Thread
1-wire keyfob and reader - by gjniewenhuijse - 12.05.2016, 11:31
RE: 1-wire keyfob and reader - by admin - 12.05.2016, 11:44
RE: 1-wire keyfob and reader - by admin - 13.05.2016, 06:39
RE: 1-wire keyfob and reader - by admin - 12.10.2016, 13:03
RE: 1-wire keyfob and reader - by Jose - 13.09.2018, 11:39
RE: 1-wire keyfob and reader - by Daniel - 13.09.2018, 12:04
RE: 1-wire keyfob and reader - by admin - 13.09.2018, 12:38
RE: 1-wire keyfob and reader - by Jose - 13.09.2018, 14:35

Forum Jump: