Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function On()
- turtle.select(1)
- turtle.digUp()
- turtle.select(2)
- turtle.placeUp()
- rs.setOutput("top",true)
- end
- function Off()
- rs.setOutput("top",false)
- turtle.select(2)
- turtle.digUp()
- turtle.select(1)
- turtle.placeUp()
- end
- function Write()
- local h = fs.open("Etat","w")
- h.write(Etat)
- h.close()
- end
- local modem = peripheral.wrap("left")
- local Chanel = 1505
- modem.open(Chanel)
- local h = fs.open("Sauvegarde","r")
- local Etat = "set"
- while true do
- local Event,Side, SenderChanel, ReplyChanel , Message, Distance = os.pullEvent("modem_message")
- if Event == "modem_message" and SenderChanel == Chanel then
- if Message == "Set" then
- Etat = h.readAll()
- h.close()
- if Etat == "On" then
- Write()
- On()
- elseif Etat == "Off" then
- Write()
- Off()
- end
- elseif Message == "On" then
- Etat = Message
- Write()
- On()
- elseif Message == "Off" then
- Etat = Message
- Write()
- Off()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement