Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- modem = peripheral.wrap("left")
- modem.open(123)
- local radio = {}
- local current = 0
- local volume = 0
- turtle.select(1)
- turtle.suck()
- function switch(nb)
- turtle.select(1)
- turtle.suck()
- if nb ~= 0 then
- turtle.select(nb)
- turtle.drop()
- turtle.select(1)
- end
- end
- while true do
- local event, side, sender, reply, message = os.pullEvent("modem_message")
- if sender == 123 then
- radio = textutils.unserialize(message)
- print(radio["fr"] ..":".. radio["vl"])
- if radio["fr"] ~= current then
- switch(radio["fr"])
- current = radio["fr"]
- end
- if radio["vl"] ~= volume then
- rs.setAnalogOutput("front",radio["vl"])
- end
- end
- sleep(2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement