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

Redstone Detection

Started by beecoopcool, 29 October 2014 - 02:45 PM
beecoopcool #1
Posted 29 October 2014 - 03:45 PM
Hello there,
i want a simple program, that outputs text a on a monitor when there is a redstone signal and when i turn the signal off it should output text b on the monitor and otherwise. How do I realise that?
Lyqyd #2
Posted 29 October 2014 - 06:37 PM
Moved to Ask a Pro.
KingofGamesYami #3
Posted 29 October 2014 - 06:47 PM
First, you need to know how to use a monitor.

You will want to wrap it using peripheral.wrap
The commands for the monitor are listed on the term api

As for redstone, here's the redstone api, which can be accessed both through redstone.* and rs.*

You'll also want to know while loops, and perhaps the redstone event.
Edited on 29 October 2014 - 05:48 PM
TheOddByte #4
Posted 29 October 2014 - 06:49 PM
Well for starters you should check out the wiki, it has all the information you need for this task.
Have you even tried doing this yourself? Do you have any code to show? If not then I feel like this is kinda a request..
Nonetheless, here's the basic stuff you need to know aboutGo and check out the link, I'll give you an example code here on how you can do what ( I think ) you're looking todo

--# Wrap the monitor
local monitor = peripheral.wrap( "back" )

--# Create a loop and draw and check the redstone input
while true do
    --# Draw to the monitor
    monitor.clear()
    monitor.setCursorPos( 1, 1 )
    monitor.write( rs.getOutput( "right" ) == true and "ON" or "OFF" ) 
    os.pullEvent( "redstone" )
end
DannySMc #5
Posted 30 October 2014 - 04:25 PM
Need anything, message me, will see what I can create for you?