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

Redstone detection

Started by paulleicht, 12 May 2013 - 05:52 AM
paulleicht #1
Posted 12 May 2013 - 07:52 AM
Hi i want to make a program that when the computer gets a redstone signal (by a button) he gives to bottom 2 times a redstone signal!

my code (it doesn't work <_</>):



input = rs.getInput("front")

while true do
if input == true then
rs.setOutput("bottom, true)
sleep(0.2)
rs.setOutput("bottom, false)
sleep(0.8)
rs.setOutput("bottom, true)
sleep(0.2)
rs.setOutput("bottom, false)
end
end
Lyqyd #2
Posted 12 May 2013 - 05:01 PM
Split into new topic.

You're only checking the input once.
The_Awe35 #3
Posted 12 May 2013 - 05:40 PM
If thats your exact code, then you are missing the last quotation mark around bottom.

rs.setOutput("bottom", true)

You also don't need to say

if input == true then
Just say

if input then --works the same.
end

-- you can also do false by

if not input then --checks if input is false
end
KaoS #4
Posted 12 May 2013 - 06:10 PM

while true do
  if rs.getInput("front") then
    rs.setOutput("bottom",true)
    sleep(0.2)
    rs.setOutput("bottom",false)
    sleep(0.8)
    rs.setOutput("bottom",true)
    sleep(0.2)
    rs.setOutput("bottom",false)
  end
  os.pullEvent("redstone")
end