#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C _lcd1(0x27, 16, 2);
int _dispTempLength1=0;
boolean _isNeedClearDisp1;
bool En_157160638_2;
bool Dir_157160638_2;
int MAX_157160638_2;
int MIN_157160638_2;
long Accel_157160638_2;
long Brak_157160638_2;
int VarStart_157160638_2;
long Var_157160638_2;
unsigned long currentTime_157160638_2;
unsigned long loopTime_157160638_2;
unsigned long time_157160638_2;
unsigned long time1_157160638_2;
int _gtv1 = 0;
bool _gen1I = 0;
bool _gen1O = 0;
unsigned long _gen1P = 0UL;
int _swi1;
int _disp1oldLength = 0;
int _swi2;
void setup()
{
Wire.begin();
delay(10);
_lcd1.init();
_lcd1.backlight();
currentTime_157160638_2 = micros();
loopTime_157160638_2 = currentTime_157160638_2;
Var_157160638_2 = -2147483648;
}
void loop()
{
if (_isNeedClearDisp1)
{
_lcd1.clear();
_isNeedClearDisp1= 0;
}
//Плата:1
if (1)
{
if (! _gen1I)
{
_gen1I = 1;
_gen1O = 1;
_gen1P = millis();
}
}
else
{
_gen1I = 0 ;
_gen1O= 0;
}
if (_gen1I)
{
if (_isTimer (_gen1P , 10000))
{
_gen1P = millis();
_gen1O = ! _gen1O;
}
}
if(_gen1O)
{
_swi1=200;
}
else
{
_swi1=0;
}
if((0) != (_swi1))
{
_swi2=50;
}
else
{
_swi2=0;
}
En_157160638_2 = 1;
Dir_157160638_2 = 1;
MAX_157160638_2 = _swi1;
MIN_157160638_2 = _swi2;
Accel_157160638_2 = 100L;
Brak_157160638_2 = 300L;
VarStart_157160638_2 = _swi2;
currentTime_157160638_2 = micros();
if(Var_157160638_2== -2147483648)
{
Var_157160638_2 = VarStart_157160638_2;
}
if(En_157160638_2)
{
if(Accel_157160638_2 != 0)
{
time_157160638_2 = 1000000 / abs(Accel_157160638_2);
if((currentTime_157160638_2 >= (loopTime_157160638_2 + time_157160638_2))&&(Dir_157160638_2==1)&&(Var_157160638_2<MAX_157160638_2)&&(MAX_157160638_2>=MIN_157160638_2))
{
if(Var_157160638_2 < MAX_157160638_2 - 1)
{
Var_157160638_2 = Var_157160638_2 + 1;
}
else
{
Var_157160638_2 = MAX_157160638_2;
}
loopTime_157160638_2 = currentTime_157160638_2;
}
if((currentTime_157160638_2 >= (loopTime_157160638_2 + time_157160638_2))&&(Dir_157160638_2==1)&&(Var_157160638_2>MAX_157160638_2)&&(MAX_157160638_2>=MIN_157160638_2))
{
if(Var_157160638_2 > MIN_157160638_2 + 1)
{
Var_157160638_2 = Var_157160638_2 - 1;
}
else
{
Var_157160638_2 = MIN_157160638_2;
}
loopTime_157160638_2 = currentTime_157160638_2;
}
if((currentTime_157160638_2 >= (loopTime_157160638_2 + time_157160638_2))&&(Dir_157160638_2==1)&&(Var_157160638_2>MAX_157160638_2)&&(MAX_157160638_2<MIN_157160638_2))
{
if(Var_157160638_2 > MAX_157160638_2 + 1)
{
Var_157160638_2 = Var_157160638_2 - 1;
}
else
{
Var_157160638_2 = MAX_157160638_2;
}
loopTime_157160638_2 = currentTime_157160638_2;
}
if((currentTime_157160638_2 >= (loopTime_157160638_2 + time_157160638_2))&&(Dir_157160638_2==1)&&(Var_157160638_2<MAX_157160638_2)&&(MAX_157160638_2<MIN_157160638_2))
{
if(Var_157160638_2 < MIN_157160638_2 - 1)
{
Var_157160638_2 = Var_157160638_2 + 1;
}
else
{
Var_157160638_2 = MIN_157160638_2;
}
loopTime_157160638_2 = currentTime_157160638_2;
}
}
if(Brak_157160638_2 != 0)
{
time1_157160638_2 = 1000000 / abs(Brak_157160638_2);
if((currentTime_157160638_2 >= (loopTime_157160638_2 + time1_157160638_2))&&(Dir_157160638_2==0)&&(Var_157160638_2>MIN_157160638_2)&&(MAX_157160638_2>=MIN_157160638_2))
{
if(Var_157160638_2 > MIN_157160638_2 + 1)
{
Var_157160638_2 = Var_157160638_2 - 1;
}
else
{
Var_157160638_2 = MIN_157160638_2;
}
loopTime_157160638_2 = currentTime_157160638_2;
}
if((currentTime_157160638_2 >= (loopTime_157160638_2 + time1_157160638_2))&&(Dir_157160638_2==0)&&(Var_157160638_2<MIN_157160638_2)&&(MAX_157160638_2>=MIN_157160638_2))
{
if(Var_157160638_2 < MAX_157160638_2 - 1)
{
Var_157160638_2 = Var_157160638_2 + 1;
}
else
{
Var_157160638_2 = MAX_157160638_2;
}
loopTime_157160638_2 = currentTime_157160638_2;
}
if((currentTime_157160638_2 >= (loopTime_157160638_2 + time1_157160638_2))&&(Dir_157160638_2==0)&&(Var_157160638_2<MIN_157160638_2)&&(MAX_157160638_2<MIN_157160638_2))
{
if(Var_157160638_2 < MIN_157160638_2 - 1)
{
Var_157160638_2 = Var_157160638_2 + 1;
}
else
{
Var_157160638_2 = MIN_157160638_2;
}
loopTime_157160638_2 = currentTime_157160638_2;
}
if((currentTime_157160638_2 >= (loopTime_157160638_2 + time1_157160638_2))&&(Dir_157160638_2==0)&&(Var_157160638_2>MIN_157160638_2)&&(MAX_157160638_2<MIN_157160638_2))
{
if(Var_157160638_2 > MAX_157160638_2 + 1)
{
Var_157160638_2 = Var_157160638_2 - 1;
}
else
{
Var_157160638_2 = MAX_157160638_2;
}
loopTime_157160638_2 = currentTime_157160638_2;
}
}
}
_gtv1 = Var_157160638_2;
if (1)
{
_dispTempLength1 = (((String(_gtv1, DEC)))).length();
if (_disp1oldLength > _dispTempLength1)
{
_isNeedClearDisp1 = 1;
}
_disp1oldLength = _dispTempLength1;
_lcd1.setCursor(2, 0);
_lcd1.print(((String(_gtv1, DEC))));
}
else
{
if (_disp1oldLength > 0)
{
_isNeedClearDisp1 = 1;
_disp1oldLength = 0;
}
}
}
bool _isTimer(unsigned long startTime, unsigned long period)
{
unsigned long currentTime;
currentTime = millis();
if (currentTime>= startTime)
{
return (currentTime>=(startTime + period));
}
else
{
return (currentTime >=(4294967295-startTime+period));
}
}