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

Basic program help needed please!

Started by Noisy_beaver, 05 September 2012 - 11:39 PM
Noisy_beaver #1
Posted 06 September 2012 - 01:39 AM
Hey,

I'm very new to the ComputerCraft mod and programming in general. I'm trying to use a computer in combination with the redpower frame motors to create a working 2 story elevator. I've got all the necessary connections set up, now i just need to create a program that will:

-Activate on startup, program called "lift cotrol"
-When it recieves a rs signal from the left, it will wait (x) seconds, then send 5 pulses of rs signal lasting 0.25 seconds each to the right, as well as a constant rs signal for (x) amount of seconds to the top
-Clears itself automatically ready for next activation

The computer will be completely out of reach in-game (its for an adventure map), so it needs to be able to run without a hitch, and not need any kind of attention.

If someone can show me how to do this it would be much appreciated! :D/>/>
KaoS #2
Posted 07 September 2012 - 11:23 AM
the code would be


while true do
os.pullEvent('redstone')
if rs.getInput('left') then
  rs.setOutput('top',true)
  sleep(x)
  rs.setOutput('top',false)
  for i=1,5 do
   rs.setOutput('right',true)
   sleep(0.25)
   rs.setOutput('right',false)
   sleep(0.25)
  end
end
end

but why use a computer? don't you have RP2
Edited on 07 September 2012 - 09:41 AM