When you use INPUT_PULLUP the pin reads HIGH when nothing is connected to it. When a button connects the pin to Ground it reads LOW. I think you have your logic backward.
#include <Servo.h>
const byte Button1Pin = 12;
const byte Button2Pin = 13;
const byte SerwoPin = 2;
Servo serwo;
const int pozycja = 90;/ /1st position of servo 0-180 pozycja+=position
const int mgora = 130;
const int gora = 170; //positions of servo
const int mdol = 40;
const int dol = 10;
void setup() {
Serial.begin(57600);
while (!Serial);
serwo.attach(SerwoPin);
serwo.write(pozycja); //default setting of serwo : 90 stopni
// pinMode(2, OUTPUT); //servo output
pinMode(Button1Pin, INPUT_PULLUP); //button input
pinMode(Button2Pin, INPUT_PULLUP); //button input
}
void loop() {
// If button2 is NOT pressed, go to mgors?
if (digitalRead(Button2Pin) == HIGH) {
serwo.write(mgora);
}
// Then if button1 is NOT pressed, go to mdol?
if (digitalRead(Button1Pin) == HIGH) {
serwo.write(mdol);
}
else // Button 1 is pressed
// If both are pressed, go to pozycja?
if (digitalRead(Button2Pin) == LOW) {
serwo.write(pozycja);
}
}