public void setPercentValue(Pin pin, Number percent){
        // validate range
        if(percent.doubleValue() <= 0){
            setValue(pin, getMinSupportedValue());
        }
        else if(percent.doubleValue() >= 100){
            setValue(pin, getMaxSupportedValue());
        }
        else{
            double value = (getMaxSupportedValue() - getMinSupportedValue()) * (percent.doubleValue()/100f);
            setValue(pin, value);
        }
    }
public void setPercentValue ( Pin pin , Number percent ) { if ( percent . doubleValue ( ) <= 0 ) { setValue ( pin , getMinSupportedValue ( ) ) ; } else if ( percent . doubleValue ( ) >= 100 ) { setValue ( pin , getMaxSupportedValue ( ) ) ; } else { double value = ( getMaxSupportedValue ( ) - getMinSupportedValue ( ) ) * ( percent . doubleValue ( ) / 100f ) ; setValue ( pin , value ) ; } }
Set the current value in a percentage of the available range instead of a raw value.

@param pin
@param percent percentage value between 0 and 100.