Posted 11 April 2014 - 03:00 AM
Hello, I am creating a remote controlled computer system for my server & base, However I need to re "prime" the code after each trigger of the wifi code "detectors"
Heres some code if it helps :)/>
Heres some code if it helps :)/>
-- #Clears the screen
term.clear()
term.setCursorPos(1, 1)
-- Opens any modem(s) connected to the computer
local function openRednet()
for _,side in ipairs({"top", "bottom", "front", "left", "right", "back"}) do
if peripheral.isPresent(side) and peripheral.getType(side) == "modem" then
rednet.open(side)
return side
end
end
end
modemSide = openRednet()
-- Now for the recieving code
id, msg = rednet.receive()
-- Events caused by the different commands
-- Power Events
-- shutdown Event
if msg == "os.shutdown()01" then
os.shutdown()
end
-- Restart Event
if msg == "os.reboot()02" then
os.reboot()
end
-- disk events
-- Play Disk Event
if msg == "disk.playAudio03" then
-- Start Of Code
disk.playAudio("top")
disk.playAudio("bottom")
disk.playAudio("left")
disk.playAudio("right")
disk.playAudio("front")
disk.playAudio("back")
-- End Of code
end
-- Disk eject
if msg == "disk.eject04" then
-- Start Of Code
disk.eject("top")
disk.eject("bottom")
disk.eject("left")
disk.eject("right")
disk.eject("front")
disk.eject("back")
-- End Of code
end
end