The switch will have two or three wires connected to it: an incoming hot wire, which is black; a return wire, which takes the load to the fixture and can be black, red, or any other color except green; and, occasionally, a grounding wire, which is green or bare copper. The purpose of the grounding wire is to connect the switch's metal case to earth, so that people will not be injured by contact with this case when they touch a live switch.
Switch wiring diagrams show which colors go where on the circuit. If you're lucky, the diagram also shows what number to call if there are no tags on the box. However, this information only helps if you have the number written down or know how to use your phone book. It's best to assign a specific function to each wire, just in case someone else needs to repair the system later.
Black goes to all metal parts of the house or building. This includes metal doorbells, metal roofing, metal siding, and metal fence posts. Black is also usually called "ground" because it should never be separated from electricity. So, if you see black wired to a tree, do not worry about it. If you cut off the connection, you could get hurt.
White goes to all non-metal parts of the house or building. These include plastic decking, plastic siding, and wooden framing inside walls.
The black (hot) wire is connected to the brass screw or a hole on the rear of the device on the same side as the brass screw. This wire is occasionally red. If the device has one, the green or bare copper (ground) wire connects to the green screw terminal on the switch or to the electrical box. Otherwise, it's not necessary to connect the ground wire to any part of the system.
The red (neutral) wire is attached to the steel screw or rod on the front of the device on the opposite side as the brass screw. This wire is always white or grey.
Switch wiring should always be done according to manufacturer's instructions. However, if you're only connecting one switch, you can probably skip the wiring process entirely - just make sure your black and red wires are together on one end and that they aren't touching any other parts of the wiring system.
Once you've connected all the switches, run some electricity through the circuit by plugging a lamp into an outlet with an open switch position. Make sure that both switches toggle when you turn off the lamp. This means that they'll both need to be in the off position before the power comes back on.
Now check each switch for proper operation. The lamp should come on when you push either button on the switch. If one button doesn't work, check the wiring behind the device first. A simple fault like this can be easily corrected by another person.
We know what each wire color performs in the circuit.
The switched lead (or traveler in a 3-way arrangement) is red and is connected to the switched hot heading to the lamp. A traveler is a red and white stripe that is used for 3-way installations. In your case, you'll just end this one. "Ground" refers to the earth's surface and is connected to the grounding conductor. This conductor should be installed using the ground rod method or metal conduit, and should be located near your meter either inside or outside your house.
Dimmers are devices that can be used with lamps to vary their light intensity between full on and full off. They do this by switching the power supply on and off often enough that the average value of the voltage across the lamp stays constant but the current through it varies greatly. This causes the lamp to emit more or less light depending on its make and model.
Most dimmers work by controlling the amount of time that a power transistor on an interior wall circuit is on. The transformer connected to the fixture cord supplies normal voltage to the lamp when the transistor is on. But when the transistor turns off, the power supply is removed from the line leading to the lamp. A capacitor inside the dimmer keeps the transistor on long after the power source has been removed so that there is no flickering of the lamp when it switches itself off at the end of its life.
Dimmers come in two types: magnetic and electronic. Magnetic dimmers use a triac instead of a transistor to control the current through the lamp.