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

Code Help

Started by bradenheron, 30 April 2013 - 11:26 PM
bradenheron #1
Posted 01 May 2013 - 01:26 AM
Hey guys so I had a thread going but my account just vanished somehow… anyways what I am wanting to do is to make a system that can read if an engine is working and if it is to send a signal to a main computer which then prints "name of engine" running. If the engine is not running it will send "name of engine" disabled. Also if engine is not running the main computer will send a code back and kick in a secondary engine via redstone or something. I will have several engines and want this all to be displayed on a monitor on the left side of my computer continuously. So what I do have…

Right now I have a computer at the engines and am trying to figure out how to write a code for them in the startup that can send a message (via rednet) to the main computer about the status of the engine and if the engine is not functioning to create a redstone signal.

This is the code I have (sorry that it is primitive, I am new to Lua)

rednet.open("top")
while true do
if redstone.setInput("bottom", true) then
rednet.send(6,"Farm Functioning")
else
rednet.send(6, "Farm Disabled")
redstone.setOutput("bottom", true)
end
end


when I reboot the computer I get: startup:4: attempt to call nil

If someone could help me with diagnosing the problem and possible help me with some code for the rest I would be greatly appreciative. Also, how do I make it so that everything shows on a monitor to the left?

ALSO, I am playing on mindcrack so I do not have the latest version of computercraft, sorry I dont know what version I do have.

Thanks,

Braden
Edited on 01 May 2013 - 09:03 AM
Lyqyd #2
Posted 01 May 2013 - 11:03 AM
I believe the suggested solution was to wire up each engine input and output signal to various different colors of bundled cable, then read and set the states of the various colors appropriately with the computer.
bradenheron #3
Posted 01 May 2013 - 02:17 PM
I am not sure how to do that though. Like how can the computer read the information only on the blue wire?
Lyqyd #4
Posted 01 May 2013 - 04:26 PM

if rs.testBundledInput("left", colors.blue) then
  --blue wire is active
end
bradenheron #5
Posted 01 May 2013 - 07:11 PM
ok thank you very much :)/> and is it similar to send a signal down the wire?