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

Using Redstone Bundled Output

Started by Meni, 09 January 2013 - 02:47 PM
Meni #1
Posted 09 January 2013 - 03:47 PM
Hi guys this is my first tutorial and i will try to explain the redstone.setBundledOutput() function.

First let look at the order of the cables



Understanding…
This are the cables numbers, but how do i gonna turn on/off this cables?
Simple using:

redstone.setBundledOutput(side,num)
Ok! The side is a string that is where the bundled cable is. They are "left" ,"right" ,"top" ,"bottom" ,"back" ,"front" .
But how i gonna turn on/off this cabes?
Using their numbers!
If i use num as 2 power the number of the cable. W

Why?
If you use num as 1 it will turn on the white cable, if you use 2 you will turn the orange cable, but if you use num as 3 you will turn on the white and orange cables.

OMG I want to turn on just one cable!
Easy just get the cable number and use as exponent of 2

WTF??
To turn the cable witch have the number 5 just use:

redstone.setBundleOutput(side,2^5)

But now i want the bundle cable 5 and the 11!
Simple! Just add 2^11

redstone.setBundleOutput(side,2^5+2^11)
And the result is


Now i want all cables off!
Simple just use num as 0

redstone.setBundledOutput(side,0)

OMG that is too hard!
Ok just use colors.thecolor as the num!

redstone.setBundledOutput(side,colors.white)
--Is the same think as
redstone.setBundledOutput(side,2)


Thank you guys, i hope have helped you! Any questions just reply!
Meni.
theoriginalbit #2
Posted 09 January 2013 - 03:57 PM
Good job, I know a lot of people can be confused by this. However i have a suggestion to make it easier that them having to worry about binary ( 2 ^ n ). Just use the colours API so it would be

rs.setBundledOutput( side, colors.yellow + colors.red )
etc, etc, etc :)/>

Now i want all cables off!
Simple just use num as 0

redpower.setBundledOutput(side,0)

Typo 'redpower' should be 'redstone' or 'rs' obviously…

EDIT: Also the images seem to not work…
Edited on 09 January 2013 - 02:58 PM
Meni #3
Posted 09 January 2013 - 04:27 PM
Oh sorry about that! I edit and now is correct! Im a bit tired! I dont sleep for a day… Thank you!
And about the images here is working fine i used media fire to upload id but i will try another
Andrakon #4
Posted 26 February 2013 - 10:31 AM
This helped me out a LOT! I ended up writing an API to handle all the mess of the bundled cables for me based off of using 1, 2,and 2^2 through 2^15 as the color numbers.
SuicidalSTDz #5
Posted 26 February 2013 - 10:39 AM
Now we can use redset <side> <color> <state> Very helpful API. Also, nice tutorial for players getting into Bundled Cabling. Very nice.
Lyqyd #6
Posted 26 February 2013 - 11:07 AM
This is somewhat unclear in that it suggests that the colors are numbered 1-16, then suggests that you raise 2 to the power of the number of the cable (i.e., 2^1 through 2^16), when in fact, the range of numbers is 2^0 through 2^15.
Neekow #7
Posted 03 March 2013 - 02:32 PM
Hum … will try to explain but will be hard …
command with variable is missing?

So to do it: rs.setBundledOutput("side", variable)

i.e:

local signal = 0


while true do
  rs.setBundledOutput("side", 2^signal)
  signal = signal+1
  if signal > 15 then signal = 0 end
  sleep(0.5)
end

with this, you will see every output 1 by 1.


I know, most of people know this, but not every one ^^
redeye83 #8
Posted 05 March 2013 - 11:46 AM
I know theoriginalbit said this but I wanted to second it, Its so much simpler to use the colors rather than the numbers.
CrazyTech13 #9
Posted 12 October 2013 - 01:36 PM
An easier/lazier way to do this is:

rs = peripheral.wrap(side) – Side is the side the cable is on
rs.setBundledOutput(colors.color or number)

That way you don't have to type the side the cable is on every time.
(Correct me if I am wrong)
But good tutorial.