Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ocs/apis/sensor")
- local mySensor = sensor.wrap("top")
- local target_list = {}
- function getEvent()
- target_list = mySensor.getTargetDetails("CURRENT")
- return target_list["Raining"]
- end
- function home()
- while true do
- if getEvent() then
- rs.setOutput("right",true)
- print("pioggia rilevata")
- sleep(1)
- rs.setOutput("right",false)
- while getEvent() do
- sleep(10)
- end
- term.clear()
- term.setCursorPos(1,1)
- end
- sleep(1)
- end
- end
- home()
Advertisement
Add Comment
Please, Sign In to add comment