This is an instructable on Minecraft. I will be introducing an automatic lighting system that goes on when you enter a room, and goes out after a while unless you turn on the light switch.
Step 1: Creating a World
In order to do this the first time, we need a nice, flat world. Create a new world. Select superflat and use the preset redstone ready. Create the world. You should be spawned into a world like what I have here. All those letters are the debug screen.
Step 2: The Flip Flop Hold Switch
To keep the light on for 40 seconds, we need a way to have the output remain on while we aren't on the pressure plate. To do this, we use a flip flop hold switch. Right underneath the pressure plate, place redstone. Trail it to a certain point, less that 15 blocks away. Dig a hole in the ground and place a sticky piston with an iron block on top. Get behind the iron block and place a redstone repeater pointing away from the iron block.Dig down in front of the repeater and place a piston right in front of the repeater, and not one block below. Then paste a redstone block on the piston and a redstone dust one block in front and below it. I have made a demonstration of how it works. The redstone leads to the thing you're powering. When you step on the pressure plate, the lamp turns on. When you step on it again, the lamp turns off.
Step 3: The Pulse Shortener
Trail the redstone to the surface and place an iron block in front of it. Then place a repeater in front of the iron. This will keep the flip flop hold switch from constantly powering the repeaters, which will keep the whole thing from working.
Step 4: The Delay
Now, place 25 redstone repeaters in a line. Turn right and repeat. Turn right and repeat. Turn right again, but leave the last two repeaters. Trail the redstone right, and place two repeaters along the way. Now make the repeaters go to the fourth tick by right clicking them three times each. Dig a hole to the flip flop hold switch and connect it as in the picture.
Step 5: The Light
Now build a small house with a redstone lamp in the roof. Run the redstone from right before the pulse shortener up to the roof of the house to the redstone lamp. Put a lever in the house. Outside, a redstone torch should go on the block that the lever is on. Above the redstone torch, place a block to be powered by the redstone torch. Run the redstone from that torch to the lamp. This will be the manual switch.
Step 6: Testing the Lamp
Step on the pressure plate. The light should go on. After a while, it should go off. Step on the pressure plate again. This time, turn on the light switch. This time, even when the flip flop goes out, the light should remain on because of the switch inside.
Step 7: What Is Really Going On
So, you want to know how this works? Well, When you step on the pressure plate, power is sent to the flip flop. Then the flip flop sends a constant redstone power even when you aren't stepping on the pressure plate. The constant power is sent to the lights and the pulse shortener. The lights remain on. The pulse shortener cuts the power to one short pulse which flows through the 100 repeaters. When it reaches the other side, it flows to the flip flop, cutting the power output which, in turn, makes the light go out and the pulse shortener go back to its first state. But, if you turned on the inside light switch, the light would stay on even when the flip flop goes out.
Step 8: Create Another One
If you want, go now to a real world and make the same circuit underground to hide it.