@@ -0,0 +1,1307 @@
+package com.easternedgerobotics.rov.control;%0A%0Apublic final class AnalogToPowerLevel %7B%0A    private AnalogToPowerLevel() %7B%0A    %7D%0A%0A    /**%0A     * Used to scale the value to the %5B0, 110%5D range.%0A     */%0A    private static final int SCALAR = 110;%0A%0A    /**%0A     * Used to shift the value to the %5B-5, 105%5D range.%0A     */%0A    private static final int OFFSET = 5;%0A%0A    /**%0A     * Lower bound for the result.%0A     */%0A    private static final int MINIMUM = 0;%0A%0A    /**%0A     * Upper bound for the result.%0A     */%0A    private static final int MAXIMUM = 100;%0A%0A    /**%0A     * Transform an analog pin value into an appropriate power slider value%0A     * with dead-bands at the top and bottom of the slider.%0A     *%0A     * @param analogValue the input.%0A     * @return power slider value.%0A     */%0A    public static int convert(final float analogValue) %7B%0A        return clamp(((1 - analogValue) * SCALAR) - OFFSET);%0A    %7D%0A%0A    /**%0A     * Clamp the value between the maximum and minimum supported power values.%0A     *%0A     * @param value the power slider value.%0A     * @return clamped value.%0A     */%0A    private static int clamp(final float value) %7B%0A        if (value %3C MINIMUM) %7B%0A            return MINIMUM;%0A        %7D%0A        if (value %3E MAXIMUM) %7B%0A            return MAXIMUM;%0A        %7D%0A        return Math.round(value);%0A    %7D%0A%7D%0A

Convert an analog pin value into a slider value