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
#4
Here's a basic example, create a resident script with sleep time = 0. os.sleep at the end tells how often the 1-Wire bus is polled for new devices. Can you explain what kind of task do you have, some kind of access / door control or similar? I can provide a better example if the details are known Smile

Code:
if not ow then
  require('ow')
  
  -- list of allowed devices
  allowed = { '3A.B9901C000000' }
end

-- list of connected devices
visible = ow.list(true)

-- find if any allowed devices are present
for _, id1 in ipairs(visible) do
  for _, id2 in ipairs(allowed) do
    if id1 == id2 then
      -- do something here
    end
  end
end

os.sleep(0.5)
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: