Advertisement
Sv443

ComputerCraft Redstone NOT Gate

Dec 28th, 2023
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.60 KB | Gaming | 0 0
  1. -- Redstone input side
  2. INPUT = "left"
  3.  
  4. -- Redstone output side
  5. OUTPUT = "back"
  6.  
  7. -- How often to check for changes, in seconds
  8. -- Has to be a multiple of 0.05 (1 game tick)
  9. CHECK_INTERVAL = 0.05
  10.  
  11. function run()
  12.     print("\n| NOT gate by Sv443")
  13.     print("| https://github.com/Sv443/ComputerCraft-Projects\n")
  14.     local outVal
  15.     while true do
  16.         local a = redstone.getInput(INPUT)
  17.  
  18.         if a then
  19.             outVal = false
  20.         else
  21.             outVal = true
  22.         end
  23.  
  24.         redstone.setOutput(OUTPUT, outVal)
  25.         os.sleep(CHECK_INTERVAL)
  26.     end
  27. end
  28.  
  29. run()
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement