Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Script to control a wall lamp
- -- written by craftersanonmoose
- -- version history
- -- version 0.1
- -- button control
- --------------------------------------------
- os.loadAPI("button")
- mon = peripheral.wrap("monitor_8")
- mon.clear()
- -- change name of these as needed
- ri = peripheral.wrap("redstoneIntegrator_1")
- function lightOn()
- ri.setAnalogOutput("front", 15)
- button.flash("Light")
- end
- function lightOff()
- ri.setAnalogOutput("front", 0)
- button.flash("Light")
- end
- function fillTable()
- button.setTable("On", lightOn, 2,8,3,5)
- button.setTable("Off", lightOff, 10,16,3,5)
- button.screen()
- end
- function getClick()
- event,side,x,y = os.pullEvent("monitor_touch")
- button.checkxy(x,y)
- end
- fillTable()
- button.heading("Light Control")
- while true do
- getClick()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement