MG995 + ESP8266 Code, need to know more please

Hi guys, i am pretty news with arduino and electronic but i have a little background with programmation.

I have fews question on this code, i take it on a website for example and want to work with to do what i want.

What i want it having 3 buttons on my blynk app to tilt my blinds on 3 position : Close up, Close down and open.

My question is : How i can determine to my button when i click on it, to turn CW 5 sec, on other button to turn CCW 5 sec and the other CW or CCW depending on what side was the last position to 2.5 sec.

My other question is : How the Int Pos; was determine ?

I search on the internet but never see something like that with Blynk.

Thank all

I have this code for starting :

#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <Servo.h>

char auth[] = "XXXXXXXXXXXXXXXXXXXXXXXXXXX";
char ssid[] = "XXXXXXXXXX";
char pass[] = "XXXXXXXXX";

Servo servo;

void MG995() {
int pos = 0;

for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees ,in steps of 1 degree
servo.write(pos); // tell servo to go to position in variable 'pos'
delay(5); // waits 15ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
servo.write(pos); // tell servo to go to position in variable 'pos'
delay(10); // waits 15ms for the servo to reach the position
}
}

BLYNK_WRITE(V3)
{
int pinValue = param.asInt();
if (pinValue == 1) { // if Button sends 1
MG995(); // start the function cradle
Blynk.run(); // Run rest of show in-between waiting for this loop to repeat or quit.
int pinValue = 0; // Set V3 status to 0 to quit, unless button is still pushed (as per below)
Blynk.syncVirtual(V3); // ...Then force BLYNK_WRITE(V3) function check of button status to determine if repeating or done.
}
}

void setup()
{
// Debug console
Serial.begin(9600);

Blynk.begin(auth, ssid, pass);

servo.attach(15); //attaches servo to pin 15 (D8 on node mcu)
}

void loop()
{
Blynk.run();
}

Please use the Code tags to post your code, you won't get answers with such questions as no one wants to read.