#include <MobaTools.h>
MoToServo servo;
const byte servo_pin = 4;
const byte POS_A = 10;
const byte POS_B = 170;
const byte SPEED = 30;
const byte LED_pin=LED_BUILTIN;
const byte button = 2; 
void setup() {
  //Serial.begin(115200);
  //Serial.println("Hello, MobaTools !");
  servo.attach(servo_pin, true);  
  pinMode(button, INPUT_PULLUP);  // Taste ist mit GND verbunden ( LOW wenn gedrückt )
  pinMode(LED_pin, OUTPUT);       // onboard LED als Statusanzeige
  servo.setSpeed(SPEED);
}

void loop() {
  digitalWrite(LED_pin, ! digitalRead(button));

  if (digitalRead(button)) {
        if ( servo.read() != POS_A ) servo.write( POS_A); 
  } else {
        if ( servo.read() != POS_B ) servo.write( POS_B); 
  }
}