learning the ropes (struggling beginner)

hi, ive got a project where i have to create a light switch that turns off 2 minutes after the light switch has been turned off. for it i have decided to use a dimmer (where by u turn the knob to a certain point and 2 minutes after it has been turned the light turns off). for it i have to use a hall effect sensor (magnetic) with a magnet attached to the knob, and I also need to fade the light off. i have no idea how to code it on Arduino, and have looked up on advice but have got vastly different answers. if there is anyone out there who could help me or even provide some code then that would be much appreciated.
thanks!

I would start smaller and safer as a beginner. Dealing with mains voltages in light switches is quite dangerous, especially for a beginner. Unless you are an electrician.

Try the fade tutorial to get the basic idea. It uses pwm on an analog output to an LED.

A household light probably can't handle pwm so you may need to wire it up to a transistor set up like an amplifier. You can then control the light brightness by adjusting your gate voltage (which you would control/dim using the arduino). I would not attempt messing with mains unless you know what you are doing as you can get seriously injured.

Most people will not offer you code, especially with all the school projects/homework that people are asking help for. If you write some of your own code though, people are most likely to help you fix the errors.

JesterSig:
Try the fade tutorial to get the basic idea. It uses pwm on an analog output to an LED.
http://arduino.cc/en/Tutorial/Fade#.Uyw9ePldWPs

A household light probably can't handle pwm so you may need to wire it up to a transistor set up like an amplifier. You can then control the light brightness by adjusting your gate voltage (which you would control/dim using the arduino). I would not attempt messing with mains unless you know what you are doing as you can get seriously injured.

Most people will not offer you code, especially with all the school projects/homework that people are asking help for. If you write some of your own code though, people are most likely to help you fix the errors.

The PWM requires something a bit more special (Triac) than a standard transistor. Do not try what is mentioned here. If you are determined to go forward, I would look up triac dimmers. Again, I do not recommend messing with your mains voltage unless you know what you are doing.

No. Bad match.