Posted 07 January 2013 - 05:39 AM
I want to write a program that sends information about a redstone energy cell (from Thermal Expansion) using a computer connected with MiscPeripherals, to another computer, that then prints it onto a monitor. I have all the code written but it doesn't seem to work. I've been trying to figure it out for the past 2 hours but nothing I do seems to work… This is the first time I've tried to do anything with rednet so it's pretty confusing to me. Any help is greatly appreciated.
Here's the code for the sender:
Here is the code for the receiver:
Here's the code for the sender:
rednet.open("right")
m = peripheral.wrap("left")
noEn = false
fullEn = false
while true do
data = m.get()
if (data["No Energy"]) and not noEn then
redstone.setOutput("back", true)
noEn = true
rednet.broadcast("enOn")
else
noEn = false
end
if (data["Full Energy"]) and not fullEn then
redstone.setOutput("back", false)
fullEn = true
rednet.broadcast("enOff")
else
fullEn = false
end
sleep(0.5)
end
Here is the code for the receiver:
rednet.open("right")
m = peripheral.wrap("left")
m.clear()
m.setCursorPos(9,1)
m.write("Engine Status")
m.setCursorPos(1,2) --Probably an inefficient way to do this but it works.
m.write("#############################")
m.setCursorPos(1,3)
m.write("# #")
m.setCursorPos(1,4)
m.write("# #")
m.setCursorPos(1,5)
m.write("# #")
m.setCursorPos(1,6)
m.write("# #")
m.setCursorPos(1,7)
m.write("# #")
m.setCursorPos(1,8)
m.write("# #")
m.setCursorPos(1,9)
m.write("# #")
m.setCursorPos(1,10)
m.write("# #")
m.setCursorPos(1,11)
m.write("# #")
m.setCursorPos(1,12)
m.write("#############################")
while true do
x = rednet.receive()
if x == enOn then
m.setCursorPos(6,9)
m.write("Engines On")
else
m.setCursorPos(6,9)
m.write("Engines Off")
end
end