4 posts
Posted 14 July 2015 - 02:35 PM
Hi there! I'd like to have a computer that when it receives a signal from either top, behind, right or left it will display information on a monitor.
For example, when a chest is full I'd like it to say Chest full or when the backup power is empty I'd like it to say backup power empty and is it possible to have redstone inputs from more than 1 side?
Thanks!
- SurRainbow
3057 posts
Location
United States of America
Posted 14 July 2015 - 07:33 PM
It is possible to have redstone inputs from multiple sides, that is why there is an argument for rs.getInput.
while true do
term.clear()
term.setCursorPos( 1, 1 )
for i, side in pair( rs.getSides() ) do
print( side .. ": " .. rs.getInput( side ) )
end
end
Edited on 14 July 2015 - 05:34 PM
4 posts
Posted 19 July 2015 - 04:18 AM
Is this only on the computer though? Is there any other ways it can read a signal? I need about 8
Thanks!
- SurRainbow
323 posts
Location
Boston, MA
Posted 19 July 2015 - 04:47 AM
If by "read a signal" you mean tell whether it is on or off, then you can get six values; one on top, bottom, left, right, front, and back of the computer.
The code above shows which sides have something on or off. You could assign a variable to each side and if it's on (the value would be true) or off (the value would be false) you could write the program accordingly.
3057 posts
Location
United States of America
Posted 19 July 2015 - 04:51 AM
If available you could use bundled cable, depending on your version of CC and the mod supplying the bundled cable. That allows you to have 8 inputs per side, per computer.
Edited on 19 July 2015 - 02:51 AM
1583 posts
Location
Germany
Posted 19 July 2015 - 05:34 AM
If available you could use bundled cable, depending on your version of CC and the mod supplying the bundled cable. That allows you to have 8 inputs per side, per computer.
Wasn't it 16 inputs per bundled cable, one for every color?
4 posts
Posted 13 October 2016 - 08:40 AM
Hey there… Sorry to bump the post… but a year later I've gotten back into the game and still with little knowledge about this mod…
Would you guys pretty please write a code that when there's a signal to the front of the computer it displays a message on the monitor that's behind it? and also displays a message when there's no signal?
Thank you!
- SurRainbow
54 posts
Location
Italy
Posted 13 October 2016 - 06:59 PM
mon=peripheral.wrap("back")
if rs.getInput("front") then --Sorry. Correcteded the do
mon.write("your text here")
else
mon.write("your text here")
end
Now it's up to you to adjust this ;)/>
Edited on 13 October 2016 - 07:33 PM
3057 posts
Location
United States of America
Posted 13 October 2016 - 07:08 PM
Minor modification to Larry's code (because it will error…)
local mon = peripheral.wrap( 'back' )
term.redirect( mon )
while true do
if rs.getInput( "front" ) then
print( "Redstone: ON" )
else
print( "Redstone: OFF" )
end
os.pullEvent( "redstone" )
end
54 posts
Location
Italy
Posted 13 October 2016 - 08:39 PM
Minor modification to Larry's code (because it will error…)
local mon = peripheral.wrap( 'back' )
term.redirect( mon )
while true do
if rs.getInput( "front" ) then
print( "Redstone: ON" )
else
print( "Redstone: OFF" )
end
os.pullEvent( "redstone" )
end
Ops… I've made a pretty obvious mistake… :shame :P/>
Edited on 13 October 2016 - 06:39 PM