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

Basic Programing help

Started by Zombiebrine, 27 July 2012 - 10:31 PM
Zombiebrine #1
Posted 28 July 2012 - 12:31 AM
How would i code a program that opens a door for 3 minutes and then shuts it. I know i can use
redpulse direction 1 180
but i want something shorter and quicker to type.
Also i need to know how to create this program.

On top of that, how would i make a program that waits 30 minutes and emits a redstone pulse, then restarts the 30 minute timer.
Kustus #2
Posted 28 July 2012 - 01:42 AM
this type of thing can be found in the tutorials. pretty mutch the same as a key lock door.
just remove the password part and set the sleep(time) to the wanted open time.
brett122798 #3
Posted 28 July 2012 - 01:52 AM
Not tested, my code:


repeat
print("Press Enter to open door or type 'exit' to exit.")
input = read()
redstone.setOutput("right", true)
sleep(180)
redstone.setOutput("right", false)
until input == "exit"