A system for controlling the dimming of a solid-state light source, the system comprising: a digital rectification module configured to rectify a phase-cut alternating current signal into: a rectified direct current power; and a rectified phase-cut signal; and a microcontroller configured to receive the rectified phase-cut signal, wherein the microcontroller is configured to: measure the rectified phase-cut signal and determine a low value and a high value thereon; and generate a signal based on the low value and the high value, wherein the signal is a pulse-width modulation, PWM, signal; and wherein the microcontroller is further configured to measure, within a given period, a duration of the low state of the rectified phase cut signal and output the low value based thereon; and measure, within the given period, a duration of the high state of the rectified phase-cut signal and output the high value based thereon; and characterised in that the microcontroller is further configured to: store an accepted low value and an accepted high value of the rectified phase-cut signal; compare the low value against a half-cycle period of the rectified phase-cut signal; compare the high value against the half-cycle period of the rectified phase-cut signal; reset the low value with the accepted low value if the low value exceeds the half-cycle period of the rectified phase-cut signal; and reset the high value with the accepted high value if the high value exceeds the half-cycle period of the rectified phase-cut signal. a digital rectification module configured to rectify a phase-cut alternating current signal into: a rectified direct current power; and a rectified phase-cut signal; and a rectified direct current power; and a rectified phase-cut signal; and a microcontroller configured to receive the rectified phase-cut signal, wherein the microcontroller is configured to: measure the rectified phase-cut signal and determine a low value and a high value thereon; and generate a signal based on the low value and the high value, wherein the signal is a pulse-width modulation, PWM, signal; and wherein the microcontroller is further configured to measure, within a given period, a duration of the low state of the rectified phase cut signal and output the low value based thereon; and measure, within the given period, a duration of the high state of the rectified phase-cut signal and output the high value based thereon; and characterised in that the microcontroller is further configured to: store an accepted low value and an accepted high value of the rectified phase-cut signal; compare the low value against a half-cycle period of the rectified phase-cut signal; compare the high value against the half-cycle period of the rectified phase-cut signal; reset the low value with the accepted low value if the low value exceeds the half-cycle period of the rectified phase-cut signal; and reset the high value with the accepted high value if the high value exceeds the half-cycle period of the rectified phase-cut signal. measure the rectified phase-cut signal and determine a low value and a high value thereon; and generate a signal based on the low value and the high value, wherein the signal is a pulse-width modulation, PWM, signal; and wherein the microcontroller is further configured to measure, within a given period, a duration of the low state of the rectified phase cut signal and output the low value based thereon; and measure, within the given period, a duration of the high state of the rectified phase-cut signal and output the high value based thereon; and characterised in that the microcontroller is further configured to: store an accepted low value and an accepted high value of the rectified phase-cut signal; compare the low value against a half-cycle period of the rectified phase-cut signal; compare the high value against the half-cycle period of the rectified phase-cut signal; reset the low value with the accepted low value if the low value exceeds the half-cycle period of the rectified phase-cut signal; and reset the high value with the accepted high value if the high value exceeds the half-cycle period of the rectified phase-cut signal. store an accepted low value and an accepted high value of the rectified phase-cut signal; compare the low value against a half-cycle period of the rectified phase-cut signal; compare the high value against the half-cycle period of the rectified phase-cut signal; reset the low value with the accepted low value if the low value exceeds the half-cycle period of the rectified phase-cut signal; and reset the high value with the accepted high value if the high value exceeds the half-cycle period of the rectified phase-cut signal.