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

Help with Redpower Frame control from button press

Started by roy20050, 13 March 2013 - 03:53 PM
roy20050 #1
Posted 13 March 2013 - 04:53 PM
programming, need help writing it. hello I'm new to coding specially in computercraft and the forums in general; this i know will be a very simple program i'm sure but i cant seem to get it. i'm trying to make the computer detect a redstone signal from the press of a button on the wall that then will use "redpulse" and send the pulses to the frame motor 3 times at a rate of .85 and raise the frames. id love any help with it.
Lyqyd #2
Posted 13 March 2013 - 04:56 PM
Split into new topic. A title was provided for you.
oeed #3
Posted 13 March 2013 - 06:20 PM
This has been asked before, but I'll get you started.


while true do
   var event, side  = os.pullEvent("redstone") -- Detect the button redstone signal
   local frameSide = "left" --change this to what ever side the frame redstone wire is
   local function pulse(delay) --basically the same as 'redpulse'
	   redstone.setOutput (frameSide, true)
	   sleep(delay)
	   redstone.setOutput (frameSide, false)
	   sleep(delay)
	end
	pulse(0.85)
	pulse(0.85)
	pulse(0.85)
end
ChunLing #4
Posted 13 March 2013 - 11:31 PM
You might want to move the local declarations of fixed variables (framSide and pulse()) outside of the loop, so they don't get reallocated every time.
oeed #5
Posted 13 March 2013 - 11:52 PM
You might want to move the local declarations of fixed variables (framSide and pulse()) outside of the loop, so they don't get reallocated every time.

Yea, It was just a quick demo I made in a minute or two.