init();
while(1)
{
global_check();
switch(step)
{
case 1:{
if(!auto_check())
step = 2;
else step = 18;
}break;
case 2: {
if(!wait_for_user())
{
step = 3;
}
}break;
case 3: {
if(!start_countdown())
{
step = 4;
}
}break;
case 4: {
if(!let_water_in())
{
step = 5;
}
}break;
case 5: {
if(!do_wash())
{
step = 6;
}
}break;
case 6: {
if(!let_water_out() && count_wash != 2)
{
step = 4;
}else if(!let_water_out() && count_wash == 2)
{
step = 7;
}
}break;
case 7: {
if(!do_dry())
{
step = 8;
}
}break;
case 5: {
finished();
step = 2;
}break;
case 18: {
while(1){
alarm();
}
}break;
default: break;
}
}