Intensity control of a bulb using core

Hey guys,
I am on a project of controlling the switching of devices using wi-fi , i am further intrested to vary the intensity of the bulb using the pwm by the analog pins of the core, i need help on what to use for the same.
a simple on off could be controlled using a rectifier , what should be done to vary the intensity.

Perhaps you can take some inspiration from the Spark Socket, the project that Sparked the Particle revolution :wink:

thank you