Understood and I am again so sorry for me to be able to do so, it is just really complicated for me. From what I understood I took some parts of the SateChangeDetect or however it is called and found the bit that does all the magic and wizardry (for me I know that you guys probably think that I am the biggest retard that is) and copied it into the code.
#include <Servo.h>
Servo m1;
const byte buttonPin = A2;
const int ledPin = 9;
const int mypulsebase = (1000);
const int pulseIncrement = (250);
const int myPulsetime = mypulsebase;
int buttonPushCounter = 0; // counter for the number of button presses
int buttonState = 0; // current state of the button
int lastButtonState = 0;
void setup() {
// initialize the button pin as a input:
pinMode(buttonPin, INPUT_PULLUP);
// initialize the LED as an output:
pinMode(ledPin, OUTPUT);
// initialize serial communication:
Serial.begin(9600);
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState != lastButtonState) {
// if the state has changed, increment the counter
if (buttonState == HIGH) {
// if the current state is HIGH then the button went from off to on:
buttonPushCounter++;
Serial.println("on");
Serial.print("number of button pushes: ");
Serial.println(buttonPushCounter);
} else {
// if the current state is LOW then the button went from on to off:
Serial.println("off");
}
// Delay a little bit to avoid bouncing
delay(50);
}
// save the current state as the last state, for next time through the loop
lastButtonState = buttonState;
if (buttonPushCounter % 0 == 1) {
m1.attach(9);
m1.writeMicroseconds(myPulsetime + pulseIncrement);
delay(1);
} else {
m1.writeMicroseconds(1000);
delay(1);
if (buttonPushCounter % 0 == 2) {
m1.attach(9);
m1.writeMicroseconds(myPulsetime + pulseIncrement + pulseIncrement);
delay(1);
} else {
m1.writeMicroseconds(1000);
delay(1);
if (buttonPushCounter % 0 == 3) {
m1.attach(9);
m1.writeMicroseconds(myPulsetime + pulseIncrement + pulseIncrement + pulseIncrement);
delay(1);
} else {
m1.writeMicroseconds(1000);
delay(1);
if (buttonPushCounter % 0 == 4) {
m1.attach(9);
m1.writeMicroseconds(myPulsetime + pulseIncrement + pulseIncrement + pulseIncrement + pulseIncrement);
delay(1);
} else {
m1.writeMicroseconds(1000);
delay(1);
}
}
}
}
}