     SEGMENT_ON = HIGH;
   }
   
-  analogWrite(DIGIT_1_PIN, DIGIT_OFF);
-  analogWrite(DIGIT_2_PIN, DIGIT_OFF);
-  analogWrite(DIGIT_3_PIN, DIGIT_OFF);
-  analogWrite(DIGIT_4_PIN, DIGIT_OFF);
-  digitalWrite(SEGMENT_A_PIN, SEGMENT_ON);
-  digitalWrite(SEGMENT_B_PIN, SEGMENT_ON);
-  digitalWrite(SEGMENT_C_PIN, SEGMENT_ON);
-  digitalWrite(SEGMENT_D_PIN, SEGMENT_ON);
-  digitalWrite(SEGMENT_E_PIN, SEGMENT_ON);
-  digitalWrite(SEGMENT_F_PIN, SEGMENT_ON);
-  digitalWrite(SEGMENT_G_PIN, SEGMENT_ON);
-  digitalWrite(SEGMENT_DP_PIN, SEGMENT_ON);
+  turnOffAllLedPins();
   
   if (AUTO_START) {
     previousMercurySwitchIsOn = false;

    if (mode == TEMPERATURE) setTemperature();
    else setHumidity();
  }
  
  // Draw one current digit on display
  activateDigit(INACTIVE);
  drawDigit(digits[currentDigitIndex], decimalPoints[currentDigitIndex]);
  if (mercurySwitchIsOn) {
    activateDigit(currentDigitIndex);
  }
  
  // Change current digit
  currentDigitIndex++;
  if (currentDigitIndex >= 4) currentDigitIndex = 0;
  
  delayMicroseconds(DIGIT_DELAY_IN_MICROSECONDS);
}

const byte BRIGHTNESS = 255; // 0 - min, 255 - max
const long DIGIT_DELAY_IN_MICROSECONDS = 500;

const int DHT22_PIN = A4; // SET A7 ON ARDUINO PRO MINI
const int MERCURY_SWITCH_PIN = A5; // SET A6 ON ARDUINO PRO MINI

const int DIGIT_1_PIN = 11;    // LED pin 12
const int DIGIT_2_PIN = A0;    // LED pin 9
const int DIGIT_3_PIN = A1;   // LED pin 8
const int DIGIT_4_PIN = 3;    // LED pin 6

const int SEGMENT_A_PIN = 12;  // LED pin 11
const int SEGMENT_B_PIN = A2; // LED pin 7
const int SEGMENT_C_PIN = 5;  // LED pin 4
const int SEGMENT_D_PIN = 7;  // LED pin 2
const int SEGMENT_E_PIN = 8;  // LED pin 1
const int SEGMENT_F_PIN = 13; // LED pin 10
const int SEGMENT_G_PIN = 4;  // LED pin 5
const int SEGMENT_DP_PIN = 6; // LED pin 3

byte DIGIT_OFF;
byte DIGIT_ON;
