Erster Servo Test

import com.pi4j.wiringpi.SoftPwm;

public class FirstTest
{
    static int max = 27;
    static int min = 4;
    static int pin = 27;

    static void setMin(int min){
        FirstTest.min = min;
    }

    static void setMax(int max){
        FirstTest.max = max;
    }

    public static void main(String[] args) throws InterruptedException {

        // initialize wiringPi library
        com.pi4j.wiringpi.Gpio.wiringPiSetup();

        // create soft-pwm pins (min=0 ; max=100)
        SoftPwm.softPwmCreate(pin, 0, 200);

        int j = 0;
        // continuous loop
        while (j < 10) {
            // fade LED to fully ON
            for (int i = min; i <= max; i++) {
                SoftPwm.softPwmWrite(pin, i);
                Thread.sleep(100);
            }

            // fade LED to fully OFF
            for (int i = max; i >= min; i--) {
                SoftPwm.softPwmWrite(pin, i);
                Thread.sleep(100);
            }
            j++;
        }

        // make sure to stop software PWM driver/thread if you done with it.
        //
        SoftPwm.softPwmStop(1);
    }
}