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

Bundled Cable Help

Started by Alcheya, 05 September 2012 - 04:18 PM
Alcheya #1
Posted 05 September 2012 - 06:18 PM
Would anyone know how to send rs pulses via bundled cable or turn off a redstone signal to a wire without switching to another? I'm trying to condense the code a bit. For instance, condense the following (sending 2 pulses to white).


rs.setBundledOutput("back", colors.white)
sleep(0.75)
rs.setBundledOutput("back", colors.yellow[non-existent])
sleep(0.5)
rs.setBundledOutput("back", colors.white)
sleep(0.75)
rs.setBundledOutput("back", colors.yellow)
sleep(0.75)

print("Six To One"
sleep(1.0)
shell.run("eleServer")


What I'm using this for requires a huge amount of code/possible inputs since I would be using one on each floor of a 10 story building and each one would have to accept a vast number of pulses. (for instance, on floor 6 pressing "1" would send "sixToOne", receiving computer would received "sixToOne" and send 1 pulse to yellow (close door on floor 6 via flipflop/toggleswitch) and 48 pulses to blue (frame motor "UP" 48 blocks) then 1 pulse to white (open door on floor 1 via flipflop toggle switch).

It's 9 floors, would accept approximately 90 different inputs. 81 of them would be pulses ranging from 8 to 80… going to be a long night…
Kingdaro #2
Posted 05 September 2012 - 09:43 PM
To send a "pulse" you would need to reset all outputs to 0 after sending them.

As for your question on shortening:

local function sendPulse(color)
  rs.setBundledOutput('back', colors[color])
  sleep(0.1)
  rs.setBundledOutput('back', 0)
  sleep(0.1)
end
Just implement this function and call, for example, sendPulse('white') twice.
Alcheya #3
Posted 05 September 2012 - 10:11 PM
thanks a million!
snoble2022 #4
Posted 27 December 2012 - 03:17 PM
even better use this

function sendPulse(sColor, nTimes)
  for i=1, nTimes do
    [color=#000000][size=2]rs[/size][/color][color=#666600][size=2].[/size][/color][color=#000000][size=2]setBundledOutput[/size][/color][color=#666600][size=2]([/size][/color][color=#008800][size=2]'back'[/size][/color][color=#666600][size=2],[/size][/color][color=#000000][size=2] colors[/size][/color][color=#666600][size=2][[/size][/color][color=#000000][size=2]color[/size][/color][color=#666600][size=2]])[/size][/color]
[color=#000000]  sleep[/color][color=#666600]([/color][color=#006666]0.1[/color][color=#666600])[/color]
[color=#000000]  rs[/color][color=#666600].[/color][color=#000000]setBundledOutput[/color][color=#666600]([/color][color=#008800]'back'[/color][color=#666600],[/color][color=#000000] [/color][color=#006666]0[/color][color=#666600])[/color]
[color=#000000]  sleep[/color][color=#666600]([/color][color=#006666]0.1[/color][color=#666600])[/color]
remiX #5
Posted 27 December 2012 - 09:12 PM
even better use this

function sendPulse(sColor, nTimes)
  for i=1, nTimes do
	[color=#000000][size=2]rs[/size][/color][color=#666600][size=2].[/size][/color][color=#000000][size=2]setBundledOutput[/size][/color][color=#666600][size=2]([/size][/color][color=#008800][size=2]'back'[/size][/color][color=#666600][size=2],[/size][/color][color=#000000][size=2] colors[/size][/color][color=#666600][size=2][[/size][/color][color=#000000][size=2]color[/size][/color][color=#666600][size=2]])[/size][/color]
[color=#000000]  sleep[/color][color=#666600]([/color][color=#006666]0.1[/color][color=#666600])[/color]
[color=#000000]  rs[/color][color=#666600].[/color][color=#000000]setBundledOutput[/color][color=#666600]([/color][color=#008800]'back'[/color][color=#666600],[/color][color=#000000] [/color][color=#006666]0[/color][color=#666600])[/color]
[color=#000000]  sleep[/color][color=#666600]([/color][color=#006666]0.1[/color][color=#666600])[/color]

Won't even work.