Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function openRednet()
- local listOfSides = rs.getSides()
- local listofPossibles = {}
- local counter1 = 0
- while true do
- counter1 = counter1 +1
- if peripheral.isPresent(tostring(listOfSides[counter1])) and peripheral.getType(listOfSides[counter1]) == "modem" then
- table.insert(listofPossibles,tostring(listOfSides[counter1]))
- end
- if counter1 == 6 and table.maxn(listofPossibles) == 0 then
- print("no wifi present")
- return nil
- end
- if counter1 == 6 and table.maxn(listofPossibles) ~= 0 then
- rednet.open(listofPossibles[1])
- return listofPossibles[1]
- end
- end
- end
- modemOn = openRednet()
- if modemOn == nil then
- print("No Modem")
- print("Will shutdown in 3 seconds")
- sleep(3)
- os.shutdown()
- else
- print("Opened modem on "..modemOn.." side")
- end
- id, message = rednet.receive()
- term.setCursorPos(1,1)
- print ("Device " .. id .. " sent a " .. message .. " ")
- os.sleep(1)
- term.setCursorPos(1,2)
- print ("Sending reactor info...")
- local reactor
- reactor = peripheral.wrap("back")
- if peripheral.wrap("back") then
- term.setCursorPos(1,3)
- print ("Found Reactor")
- end
- active = reactor.getActive(1)
- if active then
- term.setCursorPos(1,5)
- print ("The Reactor is: ")
- term.setTextColor(colors.green)
- print ("ON")
- else term.setTextColor(colors.white)
- print ("The Reactor is: ")
- term.setTextColor(colors.red)
- print ("OFF")
- rednet.send(15, "The Reactor is: OFF")
- os.reboot()
- end
- term.setTextColor(colors.white)
- lvl = reactor.getControlRodLevel(1)
- if lvl then
- print ("Control rod level is " .. lvl .. "% closed")
- end
- tick = reactor.getEnergyProducedLastTick(1)
- if tick then
- print (" " .. tick .. " RF/t ")
- end
- rednet.send(15, "The Reactor is: ON")
- os.sleep(1)
- rednet.send(15, "Control rod level is " .. lvl .. "% closed")
- os.sleep(1)
- rednet.send(15, " " .. tick .. " RF/t ")
- os.reboot()
- -- This is some simple code i made to get information about a Big Reactor wireless using a Pocket computer.
- -- Place a computer with a wireless modem on the left side and the Computercraft Big Reactor port right behind it.
- -- UPDATE! you need to input the right computer IDs in both programs respectivly
- -- The Pocket computer program is at /bkc8M1Bi
- -- Made by Dukrobber
Advertisement
Add Comment
Please, Sign In to add comment