Code for garage door opener

Hi, im trying to write a code that would control the motor of garage door opener. I got some basic functions working but there's a problem with reading mwing_down_state (it's an output pin). I wanted to read it's value like i did with inputs and if it was high and fotosens input was/went low then it should reverse direction. But it seems that i cant read OUTPUT pin value like that...
Here's my code, can someone give me some info how to fix it (and maybe how to improve it overall since im new to this)?

int up_btn_state = 0;
int dwn_btn_state = 0;
int stop_btn_state = 0;
int fotosens_state = 0;
int up_limit_state = 0;
int dwn_limit_state = 0;
int mwing_down_state = 0;

int motor_up = 10;
int motor_dwn = 11;

int up_btn = 3;
int stop_btn = 4;
int dwn_btn = 5;
int fotosens = 6;
int up_limit = 7;
int dwn_limit = 8;

void setup() {    
  //määrame mis pinid on sisendid ja mis väljundid.  
  pinMode(motor_up, OUTPUT);
  pinMode(motor_dwn, OUTPUT);
  pinMode(up_btn, INPUT);
  pinMode(stop_btn, INPUT);
  pinMode(dwn_btn, INPUT);
  pinMode(fotosens, INPUT);
  pinMode(up_limit, INPUT);
  pinMode(dwn_limit, INPUT);
  //viime kõik sisendid läbi softis kontrollitava 20k pullup taki HIGH peale. Inputi väärtust saame muuta lühistades selle pini maaga.
  digitalWrite(up_btn, HIGH);  
  digitalWrite(stop_btn, HIGH);
  digitalWrite(dwn_btn, HIGH);
  digitalWrite(fotosens, HIGH);
  digitalWrite(up_limit, HIGH);
  digitalWrite(dwn_limit, HIGH);
}

void loop() {
    up_btn_state = digitalRead(up_btn);
    dwn_btn_state = digitalRead(dwn_btn);
    stop_btn_state = digitalRead(stop_btn);
    fotosens_state = digitalRead(fotosens);
    up_limit_state = digitalRead(up_limit);
    dwn_limit_state = digitalRead(dwn_limit);
    mwing_down_state = digitalRead(motor_dwn);
    if (up_btn_state == LOW && stop_btn_state == HIGH && up_limit_state == HIGH) {     
      // Käivita mootor liikumissuunaga ülesse:    
      digitalWrite(motor_dwn, LOW);
      digitalWrite(motor_up, HIGH); 
      } 
    if (dwn_btn_state == LOW && stop_btn_state == HIGH && dwn_limit_state == HIGH && fotosens_state == HIGH) {     
      // Käivita mootor liikumissuunaga alla:    
      digitalWrite(motor_up, LOW);
      digitalWrite(motor_dwn, HIGH); 
      }      
    if (stop_btn_state == LOW) {
      digitalWrite(motor_up, LOW);
      digitalWrite(motor_dwn, LOW);
      }
    if (up_limit_state == LOW) {
      digitalWrite(motor_up, LOW);        
      }
    if (dwn_limit_state == LOW) {
      digitalWrite(motor_dwn, LOW);        
      }
    if (fotosens_state == LOW  && mwing_down_state == HIGH) {
      digitalWrite(motor_dwn, LOW);
      digitalWrite(motor_up, HIGH); 
    }
}

I don't see the use of the internal pullup resistors for the switch pins. Do you have external pullup resistors?

Edit: Never mind. I'm blind.

I wanted to read it's value like i did with inputs and if it was high and fotosens input was/went low then it should reverse direction. But it seems that i cant read OUTPUT pin value like that...

You should be able to read the state of an OUTPUT pin, but, really, there is no reason to. You set the pin to some state, and it didn't change on it's own (like an INPUT pin can), so its state is whatever you last set it to. It isn't that hard to use a global variable to maintain that state, and use that everywhere you change/need to know the state.

ok, but how would you put this part to function:

if (fotosens_state == LOW && mwing_down_state == HIGH) {
digitalWrite(motor_dwn, LOW);
digitalWrite(motor_up, HIGH);
}

Basically it's about photosensors. If something trips the sensor while door is moving down then it should reverse and go back up.

ok, but how would you put this part to function:

Do you mean "how do I make this work?" or "how do I put this code fragment into a function?" ?

how to make it work

int up_btn_state = 0;
int dwn_btn_state = 0;
int stop_btn_state = 0;
int fotosens_state = 0;
int up_limit_state = 0;
int dwn_limit_state = 0;
int mwing_down_state = 0;

int motor_up = 10;
int motor_dwn = 11;

int up_btn = 3;
int stop_btn = 4;
int dwn_btn = 5;
int fotosens = 6;
int up_limit = 7;

First, I'd make the things that are constants, like input and output pin numbers, into actual constants, so you don't accidentally change one.

Then, every time you change the value of the "motor_down" pin, set "mwing_down_state" to the same value.
It may be useful to do this in a macro, a function, or even a class.