Advertisement
NanoBob

keycard door

Jun 19th, 2014
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.49 KB | None | 0 0
  1. disks={
  2. [7]=true,
  3.  
  4. }
  5. drives={
  6. "drive_0",
  7. "drive_1",
  8. }
  9.  
  10. redstoneSide="bottom"
  11.  
  12.  
  13. function checkForDisk()
  14.     for id,driveSide in ipairs(drives) do
  15.         drive=peripheral.wrap(driveSide)
  16.         if disk.isPresent() then
  17.             checkDisk(driveSide)
  18.         end
  19.     end
  20. end
  21.  
  22. function checkDisk(driveSide)
  23.     if disks[disk.getID] then
  24.         redstone.setOutput(redstoneSide,true)
  25.         disk.eject(driveSide)
  26.         sleep(5)
  27.         redstone.setOutput(redstoneSide,false)
  28.     end
  29. end
  30.  
  31. while true do
  32.     checkForDisk()
  33.     sleep(1)
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement