Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("clear")
- local nlabel
- local ndat
- local tblink
- local r
- for k,v in pairs(snet.sides) do
- if peripheral.getType(v)=="mag card reader" then
- r=peripheral.wrap(v)
- end
- end
- while true do
- local st
- if r.isWaiting() then
- st=os.startTimer(0.2)
- end
- p={os.pullEventRaw()}
- if p[1]=="key" and p[2]==28 then
- shell.run("clear")
- write("data:")
- ndat=read()
- r.beginWrite(ndat,"")
- elseif p[1]=="mag_write_done" then
- blink=false
- tblink=false
- r.setInsertCardLight(false)
- print("Done!")
- elseif p[1]=="timer" and p[2]==st then
- if tblink then
- r.setInsertCardLight(false)
- tblink=false
- else
- r.setInsertCardLight(true)
- tblink=true
- end
- elseif p[1]=="mag_swipe" then
- shell.run("clear")
- print("Data: "..(p[2] or ""))
- elseif p[1]=="terminate" then
- error()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment