SHOW:
|
|
- or go back to the newest paste.
| 1 | -- Redstone Controller | |
| 2 | ||
| 3 | local modem = peripheral.wrap("back")
| |
| 4 | modem.open(997) | |
| 5 | ||
| 6 | while true do | |
| 7 | redstone.setBundledOutput("right", 0)
| |
| 8 | term.clear() | |
| 9 | term.setCursorPos(1,1) | |
| 10 | print("Redstone Controller\n")
| |
| 11 | local looping = true | |
| 12 | while looping do | |
| 13 | local output = redstone.getBundledOutput("right", 0)
| |
| 14 | print("Current Output: "..output)
| |
| 15 | local event = {os.pullEvent()}
| |
| 16 | if event[1] == "redstone" then | |
| 17 | print("Change in redstone input")
| |
| 18 | local input = redstone.getBundledInput("top")
| |
| 19 | print("Input: "..input)
| |
| 20 | if input ~= 0 then | |
| 21 | output = input | |
| 22 | else | |
| 23 | print("Input = 0. No reset needed")
| |
| 24 | end | |
| 25 | redstone.setBundledOutput("right", output)
| |
| 26 | print("New Output: "..output)
| |
| 27 | elseif event[1] == "modem_message" then | |
| 28 | print("Refreshing")
| |
| 29 | looping = false | |
| 30 | end | |
| 31 | end | |
| 32 | end |