Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Redstone input sides
- INPUT_A = "left"
- INPUT_B = "right"
- -- Redstone output side
- OUTPUT = "back"
- -- Set to true to turn this XOR gate into a XNOR gate
- OUTPUT_INVERTED = false
- -- How often to check for changes, in seconds
- -- Has to be a multiple of 0.05 (1 game tick)
- CHECK_INTERVAL = 0.05
- function run()
- print("\n| XOR / XNOR gate by Sv443")
- print("| https://github.com/Sv443/ComputerCraft-Projects\n")
- local outVal
- while true do
- local a = redstone.getInput(INPUT_A)
- local b = redstone.getInput(INPUT_B)
- if a and not b or not a and b then
- outVal = not OUTPUT_INVERTED
- else
- outVal = OUTPUT_INVERTED
- end
- redstone.setOutput(OUTPUT, outVal)
- os.sleep(CHECK_INTERVAL)
- end
- end
- run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement