This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
ghettodexter's profile picture

Reactor status VIA wifi with automatic refresh works with redstone!

Started by ghettodexter, 19 December 2012 - 05:34 PM
ghettodexter #1
Posted 19 December 2012 - 06:34 PM
This program allows a user to view the current state of their nuclear reactors heat VIA wifi. It is codded very simple and the base of this software can be used in a host of other applications outside of power management that requires long range connectivity and/or control-ability without direct contact. The codes format is written to only view the state of 4 reactors but again can be modified, the second program goes onto any computer that will be using and seeing this information, and the third program goes onto your turtle to shut off the nuclear reactor in an emergency situation.

Please leave me request and feed back on all my codes to try thanks!!!

This is for the master computer and should be a startup file (the one sending all the data)
note: 85 should be changed to the id number of your slave computer and 92 should be changed to your turtles id number.

rednet.open("top")
while true do -- loop from here
	os.pullEvent("redstone")
	if rs.getInput("left") then -- basically you'll want to set your core or cores to have its thermometers going to each side of the pc
			rednet.send(85, "Blue Core Hot") -- sending a message to the slave that...
			print("Blue core Overheating")
			print("Please check Coolant levels")
	end
	if rs.getInput("right") then
			rednet.send(85, "Yellow Core Hot")
			print("Yellow Core Overheating")
			print("Please check coolant levels")
	end
	if rs.getInput("bottom")then
			rednet.send(85, "Red Core Hot")
			print("Red Core Overheating")
			print("Please check coolant levels")
	end
	if rs.getInput("back") then
			rednet.send(85, "Green Core Hot")
			print("Green Core Overheating")
			print("Please check coolant levels")
	end
if rs.getInput("front") then --this is the part that controls emergency shutoff you can again change to whatever side suits your design.
rednet.send(85, "ERS Restart must be initiated on site")
sleep(3) -- for some reason it wont send a message to the turtle unless it sleeps first idk but it works so...
rednet.send(92, "ERS MODE") -- starting the turtle to destroy the block or fuse that shuts of all power and or clears uraniun from the core
print("Emergency Reactor Shutdown")
print("Venting active. Clean in 30 seconds, cooldown time is 1 minute.")
break -- ends the loop here
end
end
ghettodexter #2
Posted 19 December 2012 - 06:36 PM
This goes onto the Slave Computer and is your choice to make it a startup file or not…

Please leave feed back and request for me.
86 should be change to the id number of your Master computer

rednet.open("back")
mon = peripheral.wrap("top") -- unless you have a advanced monitor then delete all lines with an -- DEL at the end
while true do -- loop

	id,message = rednet.receive()
if id == 86 and message == "Blue Core Hot" then
term.redirect(mon) -- DEL
term.clear()
mon.setTextScale(1.5) -- DEL
term.setBackgroundColor(2048) -- DEL
term.setCursorPos(1,1)
print("Blue reactor core is hot")
end
if id == 86 and message == "Yellow Core Hot" then
term.redirect(mon) -- DEL
term.clear()
mon.setTextScale(1.5) -- DEL
term.setBackgroundColor(16) -- DEL
term.setTextColor(32768) -- DEL
term.setCursorPos(1,1)
print("Yellow reactor core is hot")
end
if id == 86 and message == "Red Core Hot" then
term.redirect(mon) -- DEL
term.clear()
mon.setTextScale(1.5) -- DEL
term.setBackgroundColor(16384) -- DEL
term.setTextColor(32768) -- DEL
term.setCursorPos(1,1)
print("Red reactor core is hot")
end
if id == 86 and message == "Green Core Hot" then
term.redirect(mon) -- DEL
term.clear()
mon.setTextScale(1.5) -- DEL
term.setBackgroundColor(8192) -- DEL
term.setTextColor(2048) -- DEL
term.setCursorPos(1,1)
print("Green reactor core is hot")
end
if id == 86 and message == "ERS Restart must be initiated on site" then
term.redirect(mon) -- DEL
term.clear()
mon.setTextScale(1.5) -- DEL
term.setBackgroundColor(16384) -- DEL
term.setTextColor(32768) -- DEL
term.setCursorPos(1,1)
print("Emergency Reactor shutdown Venting active. Clean in 30 seconds, cooldown time is 1 minute.")
break
end
end
Edited on 20 December 2012 - 08:13 AM
ghettodexter #3
Posted 19 December 2012 - 06:43 PM
Lastly this is the code for the turtle to automatically break a wall that in my case acts like a fuse cutting a circuit, when this happens all my reactors spit out the uranium cells they have inside into storage and shut off very simple wifi kill switch.

NOTE: this code was written for the size of the room my turtle is stored in and NOT designed for you so beware before you activate if you haven't re-written my code for you space/pathways.
Change the id 86 to the id number of your computer

rednet.open("right") -- opens wifi
while true do -- loop from here

	id,message = rednet.receive() -- leave blank to listen forever
if id == 86 and message == "ERS MODE" then -- recive message from master computer
turtle.refuel(32) -- create your own code to get your turtle to mover where need to break a wire causing the reactor to shut off
turtle.forward(1) -- moving to shut off
turtle.forward(1)
turtle.forward(1)
turtle.forward(1)
turtle.forward(1)
turtle.forward(1)
turtle.turnRight(1)
turtle.forward(1)
turtle.forward(1)
turtle.forward(1)
turtle.forward(1)
turtle.forward(1)
turtle.forward(1)
turtle.forward(1)
turtle.turnLeft(1)
turtle.forward(1)
turtle.forward(1)
turtle.forward(1)
turtle.forward(1)
turtle.dig(1) -- yay it cut the wire now to go back to start position
turtle.turnLeft(1) -- going to home
turtle.turnLeft(1)
turtle.forward(1)
turtle.forward(1)
turtle.forward(1)
turtle.forward(1)
turtle.turnRight(1)
turtle.forward(1)
turtle.forward(1)
turtle.forward(1)
turtle.forward(1)
turtle.forward(1)
turtle.forward(1)
turtle.forward(1)
turtle.turnLeft(1)
turtle.forward(1)
turtle.forward(1)
turtle.forward(1)
turtle.forward(1)
turtle.forward(1)
turtle.forward(1)
turtle.turnRight(1)
turtle.turnRight(1) -- you may want to add a line for the turtle to contact you when complete
end
end -- done