Posted 12 February 2014 - 04:03 AM
I was wondering, i am making an api to read/write to a solid state drive using two bundle cables, output on the left and input on the right. I am having the problem where the 'io.write' writes to input and is not lining input up with the correct line.
This is the code (I am using an API to assist with controlling the wires):
– output API
– this isn't my work BTW
local side = "back"
function alloff()
rs.setBundledOutput(side, 0)
end
function set(color, state)
color = colors or colours
if not color then
error("Invalid colour", 2)
end
local func = (state and colors.combine or colors.subtract)
rs.setBundledOutput(side, func(rs.getBundledOutput(side), color))
end
function get(color)
color = colors or colours
return rs.testBundledInput(side, color)
end
function toggle(color)
cstate = get(color)
if cstate == false then
set(color, true)
end
if cstate == true then
set(color, false)
end
end
–[[
function setadv(sided, color, state)
color = colors or colours
if not color then
error("Invalid colour", 2)
end
local func = (state and colors.combine or colors.subtract)
rs.setBundledOutput(sided, func(rs.getBundledOutput(sided), color))
end
–]]
function setside(s)
side = s
end
– The control API
– This is my program to control the SDD
api = output
– output information
io.write("Please Input Signal [1-9]: ")
term.setCursorPos(27,2)
Input = io.read()
if Input == 1 then
output.setside("left")
output.set("magenta", true)
redstone.output("top", true)
redstone.output("top", false)
output.set("magenta", false)
elseif
print ("This has not been implemented yet") then
end
And the output is:
> Binary output
Please Input Signal [1-9]:1
This has not been implemented yet
> _
The 1 is my Input and should lead to output on magenta!
This is the code (I am using an API to assist with controlling the wires):
– output API
– this isn't my work BTW
local side = "back"
function alloff()
rs.setBundledOutput(side, 0)
end
function set(color, state)
color = colors or colours
if not color then
error("Invalid colour", 2)
end
local func = (state and colors.combine or colors.subtract)
rs.setBundledOutput(side, func(rs.getBundledOutput(side), color))
end
function get(color)
color = colors or colours
return rs.testBundledInput(side, color)
end
function toggle(color)
cstate = get(color)
if cstate == false then
set(color, true)
end
if cstate == true then
set(color, false)
end
end
–[[
function setadv(sided, color, state)
color = colors or colours
if not color then
error("Invalid colour", 2)
end
local func = (state and colors.combine or colors.subtract)
rs.setBundledOutput(sided, func(rs.getBundledOutput(sided), color))
end
–]]
function setside(s)
side = s
end
– The control API
– This is my program to control the SDD
api = output
– output information
io.write("Please Input Signal [1-9]: ")
term.setCursorPos(27,2)
Input = io.read()
if Input == 1 then
output.setside("left")
output.set("magenta", true)
redstone.output("top", true)
redstone.output("top", false)
output.set("magenta", false)
elseif
print ("This has not been implemented yet") then
end
And the output is:
> Binary output
Please Input Signal [1-9]:1
This has not been implemented yet
> _
The 1 is my Input and should lead to output on magenta!