I do not recommend using it, but if you want to, I am leaving the original post in a spoiler here.
Spoiler
Easy Bundled Cable Control API, is what it says...
Have you ever been annoyed by the complexity of controlling redpower bundled cable output from a computercraft computer?
If so, you may want to try this API, which from here on is called the "output api"
Please let me know of any errors in the output api, or features you would like added.
Function List
Example Programs
The full list of colors you can use is:
white, orange, magenta, lightBlue, yellow, lime, pink, gray, lightGray, cyan, purple, blue, brown, green, red, and black.
Installation:
To get the output API simply run this command in a computer with the http api enabled.
Then the output API will be ready for use on that computer (as a file called output) if you want to use it on other computers run the command on them too.
If you dont have/want the http api enabled you can download it from here http://pastebin.com/fDvvvy0L.
IRC Channel at Esper/#BundledCableAPI
Planned:
LICENSE
http://creativecommo.../3.0/deed.en_US
This license only applies to THIS PROGRAM, not to minecraft, computercraft, or redpower.
You may edit, and/or use this program/API in your own programs/APIS. You do not have to leave the license comment in, but you can if you want
Easy Bundled Cable Control API, is what it says...
Have you ever been annoyed by the complexity of controlling redpower bundled cable output from a computercraft computer?
If so, you may want to try this API, which from here on is called the "output api"
Please let me know of any errors in the output api, or features you would like added.
Function List
Spoiler
- output.setside(String Side) Set the bundled cable side (Defaults to back) possible sides are: top, bottom, back, front, left, and right. You can change the side anytime
- output.set(String Color, state) Set output for a color. state is true or false, with true meaning on and false meaning off.
- output.get(String Color) Gets input from a bundled cable for color
- output.alloff() Turn all outputs off.
- output.toggle(String Color) Toggles the state of that color
Example Programs
Spoiler
To run this program you need the output api installed and a bundled cable conected to the back of the computer you run it on.
Conect a white, orange, and magenta colored wire to the bundled cable, and conect something to each of the colored wires.
The the colored wires will be turned on from white to magenta, then turned off.
This program will turn on the white wire if you give power to the red wire (useless yes, but it is just showing how to use the api)
To run this program you need the output api installed and a bundled cable conected to the back of the computer you run it on.
Conect a white, orange, and magenta colored wire to the bundled cable, and conect something to each of the colored wires.
The the colored wires will be turned on from white to magenta, then turned off.
os.loadAPI("output")
output.set("white", true)
sleep(1)
output.alloff()
output.set("orange" , true)
sleep(1)
output.alloff()
output.set("magenta", true)
sleep(1)
output.alloff()This program will turn on the white wire if you give power to the red wire (useless yes, but it is just showing how to use the api)
os.loadAPI("output")
redwire = false
while true do
redwire = output.get("red")
if redwire == true then
output.set("white", true)
end
if redwire == false then
output.alloff()
end
sleep(.1)
end
This program toggles white on and off every secondos.loadApi("output")
while true do
output.toggle("white")
sleep(1)
end
The full list of colors you can use is:
white, orange, magenta, lightBlue, yellow, lime, pink, gray, lightGray, cyan, purple, blue, brown, green, red, and black.
Installation:
To get the output API simply run this command in a computer with the http api enabled.
pastebin get fDvvvy0L output
Then the output API will be ready for use on that computer (as a file called output) if you want to use it on other computers run the command on them too.
If you dont have/want the http api enabled you can download it from here http://pastebin.com/fDvvvy0L.
IRC Channel at Esper/#BundledCableAPI
Planned:
Spoiler
Changelog:- Improve this post
allow true and false in the place of 1 and 0 in output.set("color", 1 or 0)Done- Add information about the beta
- Add requested features + updates
Spoiler
- 2.0 Beta: In progress
- 1.5 (This version) Made alot smaller with help from immibis, and added a toggle function.
- 1.4 (This version) You no longer need to use output.init() at the begining of your program
(And it doesnt exist anymore), Made most of the variables local. - 1.3 Fixed magenta wires not turning on when they are suposed to.
- 1.2 Added output.get(string color) which reads input on color and returns true or false.
- 1.1 Allowed true or false in the place of 1 and 0 in output.set("color", 1 or 0).
- 1.0 The beginning.
LICENSE
http://creativecommo.../3.0/deed.en_US
This license only applies to THIS PROGRAM, not to minecraft, computercraft, or redpower.
You may edit, and/or use this program/API in your own programs/APIS. You do not have to leave the license comment in, but you can if you want
Edited by SuPeRMiNoR2, 10 February 2015 - 07:16 PM.












