using pullstime

Matyk:
everything is working what now?

Now we move on to reducing your code by using the number in the index variable to do some "magic"

As you have seen you can use it to calculate the value to write to m1 and that is one option that I had considered suggesting, and it works but the relationship between the number of button presses and the value written is fixed which may not always be what is wanted and it required the Arduino to do the caculation each time through loop()

I was going to suggest using an array of values to be written to m1 based on the value of index.

For the sake of Matyk, an array is a way of holding a list of several values of the same type and accessing the one you want using its place in the list. The index variable gives us a convenient way to access the required value.

So, how does it work ?
Declare a global array of ints like this

int writeValues[5] = {123, 234, 345, 456, 567};  //fill in the values that you really want

NOTE: This array has 5 spaces numbered 0 to 4 NOT 1 to 5

Then, once you have the value of index you can do
m1.writeMicroseconds(writeValues[index]);

This uses index to look up the value to write. Because you have control of the values in the array the value written for each button press is fully under your control and does not need to be linear.

Give both methods a try