Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---- Basic stuff ----
- term.redirect(peripheral.wrap("top"))
- local monitor = peripheral.wrap("top")
- monitor.clear()
- monitor.setCursorPos(1,1)
- monitor.setBackgroundColor(colors.black)
- monitor.setTextSize(0.5)
- -- Setting up modem --
- local modem = peripheral.wrap("back")
- local event , side, channel , replychannel , message, distance
- -- Setting button --
- paintutils.drawFilledBox(3,3,13,8,colors.white)
- term.blit("Switch","ffffff","000000")
- ---- General functions ----
- function between ( value , lowest , highest )
- if value >= lowest and value <= highest then
- booly= true
- else
- booly= false
- end
- return booly
- end
- -- Switch light --
- switchlight()
- local bool = true
- modem.transmit(10,11,bool)
- end
- -- Setting variables --
- ---- Open Main Menu first time (important) ----
- -- "While true" start --
- while true do
- --Monitor touch event--
- local event, side, x, y = os.pullEvent(monitor_touch)
- -- Example menu button & Back button--
- if side=="top" and between(x,3,13) and between(y,3,8) then
- switchlight()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment