Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Simple Warning Light Program for ComputerCraft
- --by SemlerPDX Dec2016
- --Relays EnderIO Signal (right) to BluePower Inverted Lamp (left)
- --vars
- On = true
- Unsafe = false
- --funcs
- function fSet()
- term.clear()
- term.setCursorPos(1,1)
- end
- function fOn()
- rs.setOutput("left",false)
- On = true
- end
- function fOff()
- rs.setOutput("left",true)
- On = false
- end
- function fBlink()
- for i = 1, 10 do
- fOn()
- sleep(0.75)
- fOff()
- sleep(0.75)
- end
- end
- --mains
- function Main()
- while true do
- Unsafe = rs.getInput("right")
- if (Unsafe) and not (On) then
- fSet()
- print("unsafe")
- fBlink()
- fOn()
- end
- if not (Unsafe) and (On) then
- fSet()
- print("safe")
- fBlink()
- fOff()
- end
- sleep(6)
- end
- end
- --inits
- fSet()
- print("checking safety...")
- sleep(0.75)
- Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement