Guest User

Untitled

a guest
Jan 5th, 2013
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. shell.run("clear")
  2. local nlabel
  3. local ndat
  4. local tblink
  5. local r
  6. for k,v in pairs(snet.sides) do
  7. if peripheral.getType(v)=="mag card reader" then
  8. r=peripheral.wrap(v)
  9. end
  10. end
  11. while true do
  12. local st
  13. if r.isWaiting() then
  14. st=os.startTimer(0.2)
  15. end
  16. p={os.pullEventRaw()}
  17. if p[1]=="key" and p[2]==28 then
  18. shell.run("clear")
  19. write("data:")
  20. ndat=read()
  21. r.beginWrite(ndat,"")
  22. elseif p[1]=="mag_write_done" then
  23. blink=false
  24. tblink=false
  25. r.setInsertCardLight(false)
  26. print("Done!")
  27. elseif p[1]=="timer" and p[2]==st then
  28. if tblink then
  29. r.setInsertCardLight(false)
  30. tblink=false
  31. else
  32. r.setInsertCardLight(true)
  33. tblink=true
  34. end
  35. elseif p[1]=="mag_swipe" then
  36. shell.run("clear")
  37. print("Data: "..(p[2] or ""))
  38. elseif p[1]=="terminate" then
  39. error()
  40. end
  41. end
Advertisement
Add Comment
Please, Sign In to add comment