Dimmer to bulb control
There are serial controlled dimmers such as these for various load wattages. There are also some wireless controlled dimmers (WiFi, BlueTooth etc) listed on the same page.

For ballasted fluorescent lights, a different type of dimmer is needed: a Ballast Control Module. 

Similar, lower cost products are available on various auction sites, but caution is good when buying mains electrical equipment from overseas. Also, it might be worth verifying certification of these products for use in your country.

If you want to build your own dimmer, please note that playing with live mains can be somewhat fatal, so to speak. Unless you are qualified to work with electrical mains, this is best avoided.