Bob's Minecraft Tutorial, linked by Billy ONeal, is a useful resource, but I'll try to put the basics into words.
How is it possible for the torches to
work as both input and output to a
circuit?
Is there a practical difference between torches on the ground and torches on the wall?
Depending on where the torch is placed, neighboring blocks will be inputs or outputs, but each neighboring block is EITHER an input or an output - no blocks are both.
- A torch on the ground (in other words, on top of a block) outputs power in the 4 cardinal directions, and also outputs power to any block in the air above it.
- That torch will only accept input from the level below it, so input wires must run straight into the block the torch is sitting on.
To summarize, torches on the ground output to their level and input from the level below.
- A torch on a wall (in other words, on the side of a block) outputs power in only 3 directions (it doesn't output back into the block it's mounted on).
- That torch will accept input from the top of the block it's mounted to, and from the other 3 sides of the block it's mounted to.
In summary, torches on a wall output onto the ground and take input through the wall block.
What if two torches are both acting as output to the same redstone-wire?
What if one torch is outputting positive/on/true to a redstone-wire but another is outputting negative/off/false to the same wire?
This has been answered elsewhere, but: If any power source hooked up to that wire is on, the wire will be lit up.
How do I read the diagrams on the minecraftwiki page?
Again, I'll try to break down the basics:
- White squares are just air, nothing special
- Yellow squares are blocks
- Dark yellow squares are blocks a level below (that is, they're an abbreviation for "white on this level, yellow below")
- Grey squares are blocks on the current level with other items a level below
White and yellow squares can then have these items on them:
- Red lines are wires
- Red circles are redstone torches (which may be attached to the side of a block or sitting on one)
- Grey circles are levers
- Small dark grey rectangles are pushbuttons
- Large grey inset squares are pressure plates
So, for example:
- a red line on a yellow background is a wire on a block
- a grey circle on a yellow background is a lever on a block
- a red line on a grey background is a block over a wire
- a grey circle on a grey background is a block over a lever
Within the MCRedstoneSim program you can change levels and see the wiring and such on each level of the circuit, but these extended types of blocks exist so that the whole circuit can be communicated with one set of symbols and no need to show diagrams per level.
I was bored, so decided to make this monstrosity of a redstone circuit:
Edit: Now that Redstone Repeaters have been added to the game, even by following this design, sections 3 and 7 could be greatly diminished (as those sections are basically just repeaters).
This circuit will accomplish what your question is asking. I will explain each section of the circuit:
Red Square (#1)
This is the pressure plate the player will stand on. The end result is that your door will open if the player is standing on it, and will close when the player steps off. Also, if a certain amount of time passes by, the door will close even if the player is still stepping on the plate.
Orange Square (#2)
These are known as edge triggers. If they receive an input, their output will flash for one tick (redstone timing is measured in ticks) and stay off after that, even if the input is still receiving power.
Brown Square (#3)
This may look like a mess of NOT gates, and that's because it is a mess of NOT gates. Specifically, it is a mess of an odd number of NOT gates. This is known as a clock generator. A clock causes its output to cycle on and off continuously. The number of NOT gates in it determines the duration of the cycle (more repeaters equals a longer time spent on and off).
The clock is off, because 3a is sending it power. If the player were to step on the pressure plate, 3a would turn off, causing the clock to begin cycling.
This is one of the ways you can adjust the inactivity timeout - if you need it to last longer, add more NOT gates, and vice versa.
Dark Green Square (4)
Note that this device is multiple levels, most of which are not shown in this image. I only included it as a visual aid to show its input and outputs. If you build this circuit and wonder why it doesn't function, this is why.
This is a binary counter. Every time the torch at 4b, receives power, it counts in binary. This is the reason you need the clock - so the input will flash on and off, causing the binary counter to...count. The first flash causes the rightmost torch to turn on (00001). The next flash results in 00010, then 00011, 00100, etc. 4a is the binary counter reset, causing the torches to read 00000. This ensures that when the player steps on the plate, the counter will start fresh.
Because you will have to build a binary counter that actually works, see the schematic of one from this thread on the Minecraft Forums.
Adding or removing more bits to the binary counter is the other way you can adjust the duration of the timeout.
Teal Square (5)
Basically, when the binary counter reads 11111 (all of the torches are on), 5a will turn on, causing the RS-NOR latch at 6 to turn off regardless of whether or not the player is still on the pressure plate (RS-NOR latch explained later).
Purple Square (6)
This is an RS-NOR latch. It is effectively a 1-bit memory cell, storing either a 0 or a 1. When the block in the bottom-left corner of it receives power, the switch flips into the 1 position, causing the door to open. When the block in the top-right receives power, the latch resets, causing the door to close.
Black Square (7)
This is just a bunch of repeaters (two NOT gates). The only reason for this is so that the signal going around the right side of the circuit reaches the RS-NOR latch before this signal. If there were no repeaters here, the RS-NOR latch would switch into its on state, and then switch off right after due to being reset.
Rainbow Square! (8)
Oh look, it's finally the door!
In summary, this is what happens:
- Player steps on pressure plate
- Binary clock resets
- Clock begins cycling, causing the binary clock to count up
- RS-NOR reset wire from the pressure plate turns off
- Signal travelling through the wire to the left of the plate propagates through the edge trigger, flipping the RS-NOR into its on position
- Door opens!
Then, if the player were to step off of the plate, the wire wrapping around the right side would turn on again, causing the RS-NOR to turn off and, consequently, closing the door. Additionally, if the player continues to stand on the plate and the binary counter reaches 11111, the torch at 5a turns on, also causing the door to close.
I'm sure this circuit could be made much smaller and more efficient, but this is a proof of concept.
Best Answer
Wiki kinda made a mistake: by the "C changes from 0 to 1 or 1 to 0" it means you can design it to be edge up trigger or edge down trigger not both. If you look at the design it self you will see that the first split from input C only send pulse transitions when you change it from 0 to 1 and when you change it from 1 to 0 it's doing nothing. So this work's alright just a little miss understanding, if you need so here the edge down design I built(just added not before the C):
I fixed this in wiki so this should be fine now.
Btw you can design both edge up and down trigger, you need to send pulse(circled in black) each time the clock is changing. Do it your self as a challenge ☺