Advertisement
Wihad

CC IE Diesel Generator

Jun 25th, 2022 (edited)
1,064
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.72 KB | None | 0 0
  1. local b = false
  2. function flipFlop()
  3.     while true do
  4.         r = colors.test (redstone.getBundledInput("top"), colors.red)
  5.         g = colors.test (redstone.getBundledInput("top"), colors.green)
  6.         if g == false then
  7.             if r == false or b == true
  8.                 then b = true
  9.             end
  10.         else
  11.             b = false
  12.         end
  13.         printInfo(r, g, b)
  14.         if b == true then
  15.             redstone.setBundledOutput("top", colors.blue)
  16.         else
  17.             redstone.setBundledOutput("top", 0)
  18.         end
  19.         os.sleep (5)
  20.     end
  21. end
  22. function printInfo(r, g, b)
  23.     term.clear()
  24.     term.setCursorPos(1,1)
  25.     print("Low-Level: " .. tostring(r))
  26.     term.setCursorPos(20,1)
  27.     print("High-Level: " .. tostring(g))
  28.     term.setCursorPos(1,3)
  29.     print("output: " .. tostring(b))
  30. end
  31. flipFlop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement