Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function paintMon(side, color)
- local mon = peripheral.wrap(side)
- term.redirect(mon)
- local x,y = term.getSize()
- for i=0, x do
- for j=0, y do
- paintutils.drawPixel(i,j,color)
- end
- end
- term.restore()
- end
- function writeMon(side, text)
- local mon = peripheral.wrap(side)
- mon.setTextScale(0.5)
- term.redirect(mon)
- term.clear()
- local x,y = term.getSize()
- term.setCursorPos(math.floor(x/2 - text:len()/2 + 0.5), math.floor(y/2 + 0.5 ))
- term.setTextColor(colors.white)
- term.write(text)
- term.restore()
- end
- local input = redstone.getInput("bottom")
- while true do
- term.setCursorBlink(false)
- if input==true then
- paintMon("left",colors.red)
- writeMon("left","Aux power: OFF")
- else
- paintMon("left",colors.green)
- writeMon("left","Aux power: ON")
- end
- local event,side,x,y = os.pullEvent("monitor_touch")
- if tostring(side)=="left" then
- if input==true then
- redstone.setOutput("bottom",false)
- input=false
- else
- input=true
- redstone.setOutput("bottom",true)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement