Jump to content




Frames and computercontrol whit redstone off and on function


  • You cannot reply to this topic
5 replies to this topic

#1 Recer75

  • New Members
  • 2 posts

Posted 12 May 2013 - 04:41 AM

Hi i am new to computercraft and i need some help white the code.
I want to start the machine whit a wireless redstone signal and stop it when its off.
I don't want to have to restart the program every time i stop the signal but i have been unsuccessful in every attempt to make this happen.

The machine is mad of red power and computercraft components from the mudpack ultimate.

This is a scematic of the machine created whit world-edit
http://www.mediafire...6qa66ea96uu0i2m


y = 0
if redstone.getInput ("top",true) then
  y = 0
end
if redstone.getInput ("top",false) then
  y = x + 10
end
repeat
  redstone.setOutput ("back",true)
  sleep (0,8)
  redstone.setOutput ("back",false)
  redstone.setOutput ("right",true)
  sleep (1.0)
  redstone.setOutput ("right",false)
  sleep (1.0)
  redstone.setOutput ("bottom",true)
  sleep (1.0)
  redstone.setOutput ("bottom",false)
until y == 10


I would appreciate any help and tips that can make this work.

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 12 May 2013 - 03:57 PM

Split into new topic.

#3 KaoS

    Diabolical Coder

  • Members
  • 1,510 posts
  • LocationThat dark shadow under your bed...

Posted 12 May 2013 - 05:26 PM

repeat
  redstone.setOutput ("back",true)
  sleep (0,8)
  redstone.setOutput ("back",false)
  redstone.setOutput ("right",true)
  sleep (1.0)
  redstone.setOutput ("right",false)
  sleep (1.0)
  redstone.setOutput ("bottom",true)
  sleep (1.0)
  redstone.setOutput ("bottom",false)
until not redstone.getInput ("top") and x+10==10


#4 Recer75

  • New Members
  • 2 posts

Posted 13 May 2013 - 12:38 PM

Nice thank you. I wonder how can i make this start when i reapply the rs.getInput ("top") signal

#5 W00dyR

  • Members
  • 135 posts

Posted 13 May 2013 - 12:54 PM

while true do  -- infinite loop, so you never have to restart
  waiting = os.pullEvent()  -- waits for something to happen, like a redstone update
  if redstone.getInput("top") then
	-- whatever you want to happen here
  end
end

That should work I think :P

#6 KaoS

    Diabolical Coder

  • Members
  • 1,510 posts
  • LocationThat dark shadow under your bed...

Posted 13 May 2013 - 02:45 PM

while true do
  if not redstone.getInput ("top") and x+10==10
    redstone.setOutput ("back",true)
    sleep (0,8)
    redstone.setOutput ("back",false)
    redstone.setOutput ("right",true)
    sleep (1.0)
    redstone.setOutput ("right",false)
    sleep (1.0)
    redstone.setOutput ("bottom",true)
    sleep (1.0)
    redstone.setOutput ("bottom",false)
  end
  os.pullEvent("redstone")
end






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users