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

computer set IO to computer

Started by darcline, 22 May 2015 - 07:02 PM
darcline #1
Posted 22 May 2015 - 09:02 PM
Hello Pro´s,

can i send and receive redstone.setOutputs or .getInputs from another computer ?

the computer who gets the Input and sets Output is computer_4.

the computer that working with the programm that calls computer_4 to set a Output is computer_5.
they are connected on cable.

i only need a example for .setOutput and .getInput

thanks for help
Lupus590 #2
Posted 22 May 2015 - 11:10 PM
You don't know till you try.

If you mean to send redstone signals down modem cables, you will need to "wrap" them in the networking API (rednet API)
If you have the two computers next to each other (with dust between) then is should work.
If you have the two computers in contact with each other then I have no idea, try it and tell me.

For reference, the redstone API.
Edited on 22 May 2015 - 09:11 PM
darcline #3
Posted 23 May 2015 - 12:02 PM
sorry i think i mean this

If you mean to send redstone signals down modem cables, you will need to "wrap" them in the networking API (rednet API)

sorry my english is not so good to say what i mean and what not
Lupus590 #4
Posted 23 May 2015 - 02:25 PM
From what I understand, you want your system to transmit a redstone state from one computer to another where it recreates it.
The input computer (the one reading the redstone and sending the network message) will need something like this:

--#this is not true lua, this is psudo code
--#you will need to edit it to make it work in computercraft
while true do
  event = os.pullEvent()
  if event == redstone then
	redstoneValue = rs.getValue()
	modem.send(redstoneValue)
  end
end

The receiving computer (the one listening for modem messages and emitting redstone) will need something like this:

--#once again psudo-code
while true do
  event = os.pullEvent()
  if event = modem_message then
	redstoneValue = modem.pullMessage()
	rs.set(redstoneValue)
  end
end

you may need to read these tutorials and wiki pages
http://www.computerc...w-is-it-useful/
http://computercraft...ki/Os.pullEvent
http://computercraft...stone_%28API%29
http://computercraft...ednet_%28API%29
http://computercraft...Rednet_Tutorial
Edited on 23 May 2015 - 12:27 PM