Friday, September 30, 2011

More Simple Gates

Now that we've covered the basics, here are some more simple gates.

First is the OR gate. This is just like the basic I/O gate, but with more than one input. If at least one of its inputs is on, then the output is also on.

It doesn't matter how many inputs are in the on position for the OR gate: if at least one is on, then the output is triggered.

Next we have the NOR gate - this is the inverse version of the OR gate, like the NOT gate is to the basic I/O gate. Yes, this is going to be a pattern, and from here on out I'll just be referring to gates like this as the inverse version of whichever gate. You can always skip back to the first post if you forget what that means!
The NOR gate's output is powered off if one or more of the input switches is switched on.

Then we have the AND gate: its output is triggered only if both inputs are switched on.
If only one input for the AND gate is triggered, the output won't be triggered, but when both switches are pulled the output activates.

You're probably expecting it by now, but next is the inverse version of the AND gate: the NAND gate. It starts with the output in the on position.
And when both inputs are triggered, the output switches off.

Next up, even more logic gates!

An Intro - Input/Output Gates, NOT Gates

I'm going to assume that since you're here, you've played Minecraft and you want an explanation of how to use Redstone. I know there are other tutorials for this, but to be honest, I'm confused by them at this point. My goal here is to write a guide simple enough that even I can understand it.

So what is redstone, exactly?

Well, it's an in-game material and a terrible lighting source, but what we'll be using it for is designing circuits. I'll get into that in a moment, but first, some technical info on redstone:
Redstone wire (or powder if you prefer) can carry power, for a distance of up to 15 blocks. Powered redstone wire lights up, and as it approaches the 15-block limit it will grow dimmer, but will still be powered.
Redstone wire can be powered by levers, buttons, pressure plates, detector rails, and redstone torches.

So, more on circuits! A circuit is just the path that a charge takes through our redstone. Here are two very simple circuits, to illustrate.

This is an Input/Output (or I/O) gate. This is the simplest you can get. In this case, the input is a lever, and the output is a piston. When the lever is in the off position, the piston is also in the off position...
... And when the lever is switched to the on position, the piston is also in the on position. There are no delays.

You could also easily reverse the on and off positions of the output. To do this, you make a NOT gate: that is, a gate where the input being in a given position means the output is not in that position. In other words, an on input has an off output, and an off input has an on output.

I've illustrated this with the same lever/piston setup as before.

The addition of a second power source - the redstone torch on the other side of the block that our lever is on - changes things so that the output is powered when the lever is off...
... And when the lever is on, the redstone torch switches off and removes power from the piston.

(Notice that the redstone torch is placed on a side of the block that the lever is on? I'm pretty sure that's not meant to be necessary, but it didn't work when I tried this set-up with the redstone torch on the ground of the block it's occupying. I'm chalking it up to a bug for now since it doesn't seem to be that way in every tutorial I've checked.)

I think that covers the basics. My next post will cover some more simple gates. Once I've worked through the basics of redstone circuits, I'll be covering some projects that you can make using them - my current goal is an automated sugar cane farm.