I am trying to write a program that detects whether there is any currant coming from the yellow cable in the bundle plugged into the back of the computer, and if there is, will send currant through the redstone/bundle on the left side of the machine. Could someone write a program that does this?
-Thanks
Detecting Input From Bundled Cables
Started by Nikolai, Nov 29 2012 03:15 PM
3 replies to this topic
#1
Posted 29 November 2012 - 03:15 PM
#2
Posted 29 November 2012 - 04:28 PM
This should do it.
This will do the first part, but send the signal through the black line in the bundled cable conected to the back of your computer
If you want this as part of a program you already have then you can put it in as a function like so
while true do
yellowin = rs.testBundledInput("back", colors.yellow)
if yellowin == true then
rs.setOutput("left", true)
end
if yellowin == false then
rs.setOutput("left", false)
end
sleep(.1)
end
This will do the first part, but send the signal through the black line in the bundled cable conected to the back of your computer
while true do
yellowin = rs.testBundledInput("back", colors.yellow)
if yellowin == true then
rs.setBundledOutput("back", colors.black)
end
if yellowin == false then
rs.setBundledOutput("back", 0)
end
sleep(.1)
end
If you want this as part of a program you already have then you can put it in as a function like so
function readinput()
yellowin = rs.testBundledInput("back", colors.yellow)
if yellowin == true then
rs.setBundledOutput("back", colors.black)
end
if yellowin == false then
rs.setBundledOutput("back", 0)
end
sleep(.1)
end
Then everytime you want to check if the yellow line is on you can runreadinput()And it will run the detecter program thing that I just made
#3
Posted 29 November 2012 - 04:51 PM
Simplify his above:
function readinput()
if yellowin = rs.testBundledInput("back", colors.yellow) then
rs.setBundledOutput("back", colors.black)
else
rs.setBundledOutput("back", 0)
end
sleep(.1)
end
#4
Posted 29 November 2012 - 05:30 PM
Thanks man, that really helped. Hopefully this will help prevent most nuclear meltdowns...
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











