simple pwm is not what you want for a triac regulator , search this forum for light dimmer projects , one of them should give you some ideas