Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rfid = peripheral.wrap("top")
- speak = peripheral.wrap("left")
- distance = 3
- antiterm = false
- known = {svenn = "SIA"}
- function check(poo)
- for k,v in pairs(known) do
- if v == poo then
- return k
- end
- end
- return nil
- end
- if antiterm then
- os.pullEvent = os.pullEventRaw
- end
- while true do
- repeat
- rfid.scan(distance)
- event,param = os.pullEvent()
- if event == "rfid_detected" then
- ok = check(param)
- if ok ~= nil then
- speak.say("hello "..ok)
- os.startTimer(2)
- sleep(1.5)
- else
- speak.say("hello stranger")
- os.startTimer(2)
- sleep(1.5)
- end
- end
- until event == "rfid_scan_done" or event == "timer"
- end
Advertisement
Add Comment
Please, Sign In to add comment