added typecast for analogwrite environmentcontroller