#include <LiquidCrystal.h>
LiquidCrystal _lcd1(12, 11, 10, 9, 8, 7);
int _dispTempLength1=0;
boolean _isNeedClearDisp1;
int _disp17oldLength = 0;
bool _trgs1 = 0;
int _disp2oldLength = 0;
int _disp3oldLength = 0;
bool _bounseInputD2S = 0;
bool _bounseInputD2O = 0;
unsigned long _bounseInputD2P = 0UL;
int _disp4oldLength = 0;
int _disp11oldLength = 0;
int _disp14oldLength = 0;
bool _trgs4 = 0;
int _disp8oldLength = 0;
int _disp13oldLength = 0;
int _disp16oldLength = 0;
int _disp5oldLength = 0;
bool _trgs2 = 0;
int _disp10oldLength = 0;
bool _trgs3 = 0;
int _disp7oldLength = 0;
int _disp6oldLength = 0;
int _disp15oldLength = 0;
int _disp9oldLength = 0;
int _disp12oldLength = 0;
int _disp1oldLength = 0;
void setup()
{
    pinMode(2, INPUT_PULLUP);
    pinMode(1, OUTPUT);
    digitalWrite(1, 0);
    _lcd1.begin(20, 4);
    _bounseInputD2O =  digitalRead(2);
}
void loop()
{
    if (_isNeedClearDisp1) 
    {
        _lcd1.clear();
        _isNeedClearDisp1= 0;
    }
    bool  _bounceInputTmpD2 =  (digitalRead (2));
    if (_bounseInputD2S)
    {
        if (millis() >= (_bounseInputD2P + 40))
        {
            _bounseInputD2O= _bounceInputTmpD2;
            _bounseInputD2S=0;
        }
    }
    else
    {
        if (_bounceInputTmpD2 != _bounseInputD2O)
        {
            _bounseInputD2S=1;
            _bounseInputD2P = millis();
        }
    }
    //Плата:1
    if (1) 
    {
        _dispTempLength1 = ((String("3,3V 5,0V 12V  +-12V"))).length();
        if (_disp9oldLength > _dispTempLength1) 
        {
            _isNeedClearDisp1 = 1;
        }
        _disp9oldLength = _dispTempLength1;
        _lcd1.setCursor(0, 0);
        _lcd1.print((String("3,3V 5,0V 12V  +-12V")));
    }
     else 
    {
        if (_disp9oldLength > 0) 
        {
            _isNeedClearDisp1 = 1;
            _disp9oldLength = 0;
        }
    }
    if (1) 
    {
        _dispTempLength1 = (((_floatToStringWitRaz(((analogRead (1)))/(20.46),1)))).length();
        if (_disp1oldLength > _dispTempLength1) 
        {
            _isNeedClearDisp1 = 1;
        }
        _disp1oldLength = _dispTempLength1;
        _lcd1.setCursor(0, 2);
        _lcd1.print(((_floatToStringWitRaz(((analogRead (1)))/(20.46),1))));
    }
     else 
    {
        if (_disp1oldLength > 0) 
        {
            _isNeedClearDisp1 = 1;
            _disp1oldLength = 0;
        }
    }
    if (1) 
    {
        _dispTempLength1 = (((_floatToStringWitRaz(((map(((analogRead (2))), (512), (920), (0), (1023))))/(34.1),1)))).length();
        if (_disp2oldLength > _dispTempLength1) 
        {
            _isNeedClearDisp1 = 1;
        }
        _disp2oldLength = _dispTempLength1;
        _lcd1.setCursor(5, 1);
        _lcd1.print(((_floatToStringWitRaz(((map(((analogRead (2))), (512), (920), (0), (1023))))/(34.1),1))));
    }
     else 
    {
        if (_disp2oldLength > 0) 
        {
            _isNeedClearDisp1 = 1;
            _disp2oldLength = 0;
        }
    }
    if (1) 
    {
        _dispTempLength1 = (((_floatToStringWitRaz(((analogRead (5)))/(20.46),1)))).length();
        if (_disp7oldLength > _dispTempLength1) 
        {
            _isNeedClearDisp1 = 1;
        }
        _disp7oldLength = _dispTempLength1;
        _lcd1.setCursor(5, 2);
        _lcd1.print(((_floatToStringWitRaz(((analogRead (5)))/(20.46),1))));
    }
     else 
    {
        if (_disp7oldLength > 0) 
        {
            _isNeedClearDisp1 = 1;
            _disp7oldLength = 0;
        }
    }
    if(!(_bounseInputD2O)) _trgs2 = 1;
    if((((map(((analogRead (2))), (512), (920), (0), (1023))))/(34.1)) >= (((analogRead (5)))/(20.46))) _trgs2 = 0;
    if (1) 
    {
        _dispTempLength1 = (((((_floatToStringWitRaz(((map(((analogRead (3))), (512), (920), (0), (1023))))/(34.1),1))) + (String("A"))))).length();
        if (_disp5oldLength > _dispTempLength1) 
        {
            _isNeedClearDisp1 = 1;
        }
        _disp5oldLength = _dispTempLength1;
        _lcd1.setCursor(10, 1);
        _lcd1.print(((((_floatToStringWitRaz(((map(((analogRead (3))), (512), (920), (0), (1023))))/(34.1),1))) + (String("A")))));
    }
     else 
    {
        if (_disp5oldLength > 0) 
        {
            _isNeedClearDisp1 = 1;
            _disp5oldLength = 0;
        }
    }
    if (1) 
    {
        _dispTempLength1 = (((((_floatToStringWitRaz(((analogRead (6)))/(20.46),1))) + (String("A"))))).length();
        if (_disp8oldLength > _dispTempLength1) 
        {
            _isNeedClearDisp1 = 1;
        }
        _disp8oldLength = _dispTempLength1;
        _lcd1.setCursor(10, 2);
        _lcd1.print(((((_floatToStringWitRaz(((analogRead (6)))/(20.46),1))) + (String("A")))));
    }
     else 
    {
        if (_disp8oldLength > 0) 
        {
            _isNeedClearDisp1 = 1;
            _disp8oldLength = 0;
        }
    }
    if(!(_bounseInputD2O)) _trgs3 = 1;
    if((((map(((analogRead (3))), (512), (920), (0), (1023))))/(34.1)) >= (((analogRead (6)))/(20.46))) _trgs3 = 0;
    if (!(_trgs3)) 
    {
        _dispTempLength1 = ((String("OFF"))).length();
        if (_disp15oldLength > _dispTempLength1) 
        {
            _isNeedClearDisp1 = 1;
        }
        _disp15oldLength = _dispTempLength1;
        _lcd1.setCursor(10, 3);
        _lcd1.print((String("OFF")));
    }
     else 
    {
        if (_disp15oldLength > 0) 
        {
            _isNeedClearDisp1 = 1;
            _disp15oldLength = 0;
        }
    }
    if (_trgs3) 
    {
        _dispTempLength1 = ((String("ON"))).length();
        if (_disp14oldLength > _dispTempLength1) 
        {
            _isNeedClearDisp1 = 1;
        }
        _disp14oldLength = _dispTempLength1;
        _lcd1.setCursor(10, 3);
        _lcd1.print((String("ON")));
    }
     else 
    {
        if (_disp14oldLength > 0) 
        {
            _isNeedClearDisp1 = 1;
            _disp14oldLength = 0;
        }
    }
    if (1) 
    {
        _dispTempLength1 = (((((_floatToStringWitRaz(((map(((analogRead (4))), (512), (594), (0), (1023))))/(2.5),0))) + (String("m"))))).length();
        if (_disp6oldLength > _dispTempLength1) 
        {
            _isNeedClearDisp1 = 1;
        }
        _disp6oldLength = _dispTempLength1;
        _lcd1.setCursor(16, 1);
        _lcd1.print(((((_floatToStringWitRaz(((map(((analogRead (4))), (512), (594), (0), (1023))))/(2.5),0))) + (String("m")))));
    }
     else 
    {
        if (_disp6oldLength > 0) 
        {
            _isNeedClearDisp1 = 1;
            _disp6oldLength = 0;
        }
    }
    if (1) 
    {
        _dispTempLength1 = (((((_floatToStringWitRaz(((analogRead (7)))/(2.046),0))) + (String("m"))))).length();
        if (_disp4oldLength > _dispTempLength1) 
        {
            _isNeedClearDisp1 = 1;
        }
        _disp4oldLength = _dispTempLength1;
        _lcd1.setCursor(16, 2);
        _lcd1.print(((((_floatToStringWitRaz(((analogRead (7)))/(2.046),0))) + (String("m")))));
    }
     else 
    {
        if (_disp4oldLength > 0) 
        {
            _isNeedClearDisp1 = 1;
            _disp4oldLength = 0;
        }
    }
    if(!(_bounseInputD2O)) _trgs4 = 1;
    if((((map(((analogRead (4))), (512), (594), (0), (1023))))/(2.5)) >= (((analogRead (7)))/(2.046))) _trgs4 = 0;
    if (!(_trgs4)) 
    {
        _dispTempLength1 = ((String("OFF"))).length();
        if (_disp17oldLength > _dispTempLength1) 
        {
            _isNeedClearDisp1 = 1;
        }
        _disp17oldLength = _dispTempLength1;
        _lcd1.setCursor(16, 3);
        _lcd1.print((String("OFF")));
    }
     else 
    {
        if (_disp17oldLength > 0) 
        {
            _isNeedClearDisp1 = 1;
            _disp17oldLength = 0;
        }
    }
    if (_trgs4) 
    {
        _dispTempLength1 = ((String("ON"))).length();
        if (_disp16oldLength > _dispTempLength1) 
        {
            _isNeedClearDisp1 = 1;
        }
        _disp16oldLength = _dispTempLength1;
        _lcd1.setCursor(16, 3);
        _lcd1.print((String("ON")));
    }
     else 
    {
        if (_disp16oldLength > 0) 
        {
            _isNeedClearDisp1 = 1;
            _disp16oldLength = 0;
        }
    }
    if(!(_bounseInputD2O)) _trgs1 = 1;
    if((((map(((analogRead (0))), (512), (920), (0), (1023))))/(34.1)) >= (((analogRead (1)))/(20.46))) _trgs1 = 0;
    digitalWrite(1, ((_trgs1) && (_trgs2) && (_trgs3) && (_trgs4)));
    if (!(_trgs2)) 
    {
        _dispTempLength1 = ((String("OFF"))).length();
        if (_disp13oldLength > _dispTempLength1) 
        {
            _isNeedClearDisp1 = 1;
        }
        _disp13oldLength = _dispTempLength1;
        _lcd1.setCursor(5, 3);
        _lcd1.print((String("OFF")));
    }
     else 
    {
        if (_disp13oldLength > 0) 
        {
            _isNeedClearDisp1 = 1;
            _disp13oldLength = 0;
        }
    }
    if (_trgs2) 
    {
        _dispTempLength1 = ((String("ON"))).length();
        if (_disp12oldLength > _dispTempLength1) 
        {
            _isNeedClearDisp1 = 1;
        }
        _disp12oldLength = _dispTempLength1;
        _lcd1.setCursor(5, 3);
        _lcd1.print((String("ON")));
    }
     else 
    {
        if (_disp12oldLength > 0) 
        {
            _isNeedClearDisp1 = 1;
            _disp12oldLength = 0;
        }
    }
    if (!(_trgs1)) 
    {
        _dispTempLength1 = ((String("OFF"))).length();
        if (_disp11oldLength > _dispTempLength1) 
        {
            _isNeedClearDisp1 = 1;
        }
        _disp11oldLength = _dispTempLength1;
        _lcd1.setCursor(0, 3);
        _lcd1.print((String("OFF")));
    }
     else 
    {
        if (_disp11oldLength > 0) 
        {
            _isNeedClearDisp1 = 1;
            _disp11oldLength = 0;
        }
    }
    if (_trgs1) 
    {
        _dispTempLength1 = ((String("ON"))).length();
        if (_disp10oldLength > _dispTempLength1) 
        {
            _isNeedClearDisp1 = 1;
        }
        _disp10oldLength = _dispTempLength1;
        _lcd1.setCursor(0, 3);
        _lcd1.print((String("ON")));
    }
     else 
    {
        if (_disp10oldLength > 0) 
        {
            _isNeedClearDisp1 = 1;
            _disp10oldLength = 0;
        }
    }
    if (1) 
    {
        _dispTempLength1 = (((_floatToStringWitRaz(((map(((analogRead (0))), (512), (920), (0), (1023))))/(34.1),1)))).length();
        if (_disp3oldLength > _dispTempLength1) 
        {
            _isNeedClearDisp1 = 1;
        }
        _disp3oldLength = _dispTempLength1;
        _lcd1.setCursor(0, 1);
        _lcd1.print(((_floatToStringWitRaz(((map(((analogRead (0))), (512), (920), (0), (1023))))/(34.1),1))));
    }
     else 
    {
        if (_disp3oldLength > 0) 
        {
            _isNeedClearDisp1 = 1;
            _disp3oldLength = 0;
        }
    }
}
String  _floatToStringWitRaz(float value, int raz)
{
    return String(value,raz);
}
