Diming 220V light bulb using Triac
This is a more complete code to dim light bulb 220V/50Hz using triac, input from serial, flicker free
The instruction is from https://arduinodiy.wordpress.com/2012/10/19/dimmer-arduino/
The circuit is also quite similar.
Good luck, have fun.