Advertisement
Sam54123

Computercraft t-flip-flop

Aug 21st, 2019
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.38 KB | None | 0 0
  1. inputSide = 'bottom'
  2. outputSide = 'top'
  3.  
  4. state = false
  5.  
  6. print("Starting t-flip-flop")
  7.  
  8. while true do
  9.   os.pullEvent("redstone")
  10.   if redstone.getInput(inputSide) == false then
  11.     os.sleep(1)
  12.     if redstone.getOutput(outputSide) then redstone.setOutput(outputSide, false)
  13.     elseif not redstone.getOutput(outputSide) then redstone.setOutput(outputSide,true) end
  14.   end  
  15.    
  16. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement