sensor 30 shown in fig3 based on the detector output vout however it should be appreciated that in various alternative exemplary embodiments any of the optical sensor devices shown in fig3 and 7 u2013 10 may be used with a pwm signal input vs to variably drive the sensor emitter input based on the detector output fig1 shows an overview block diagram of an alternative exemplary optical sensor device 42 provided with a pwm based compensation circuit 110 the optical sensor device 42 is shown as being controlled by the controller 41 to produce a detector output 43 having a predetermined output level the detector output 43 is fed back to the controller 41 which uses the detector output 43 to control the pwm duty cycle driving the output level of the sensor device 42 using a pwm driver 45 based on a predetermined value the control interface relating to the control of circuit may encompass any of the state of the art methods and arrangements particularly as they relate to control of a pwm driver 45 an exemplary method for optical sensor compensation using the pwm controlled signal input vs parallels the method shown in fig5 for example references to the attenuation and attenuation range in steps 300 u2013 700 now refer to the pwm duty cycle and pwm duty cycle range respectively for example in step 300 of the pwm control method a duty cycle setting of a pwm driver is stepped through its range of duty cycle values by discrete step values to vary the output level of the detector output it should be appreciated that in various exemplary embodiments the optical emitter may be a light emitting diode in general while the term u201c light u201d is used.