Blame | Last modification | View Log | Download
void cikcak()
{
short int movement;
if(uhel>STRED)
{
movement = R;
uhel=KOLMO1;
Delay_ms(60);
}
if(uhel<STRED)
{
movement = L;
uhel=KOLMO2;
Delay_ms(60);
}
sem:
sensors = spi_read(0); // cteni senzoru
sensors=~sensors;
Delay_ms(5); // cekani na SLAVE nez pripravi data od cidel
if(!bit_test(sensors,3) == sensors)
{
if(R == movement)
{
FR;BL;
movement=L;
While(bit_test(sensors,3) == sensors)
{
sensors = spi_read(0); // cteni senzoru
sensors=~sensors;
Delay_ms(5);
}
STOPL;STOPR;
GoTo sem;
}
if(L == movement)
{
FL;BR;
movement=R;
While(bit_test(sensors,3) == sensors)
{
sensors = spi_read(0);
sensors =~ sensors;
Delay_ms(5); // cekani na SLAVE nez pripravi data od cidel
}
STOPL;STOPR;
GoTo sem;
}
}
}
////////////////////////////////////////////////////////////////////////////////
void objizdka()
{
// zjisti, jestli neni cihla, pouze pokud se jede jakztakz rovne
BL; BR;
While(bit_test(sensors,3) == sensors)
{
sensors = spi_read(0);
sensors =~ sensors;
Delay_ms(5);
}
STOPR; STOPL;
delay_ms(1000);
cikcak();
delay_ms(1000);
STOPR; STOPL;
While(true);
uhel=STRED-55;
FR;STOPL;
Delay_ms(370); // doleva
uhel=STRED;
FL;FR;
Delay_ms(200); // rovne
uhel=STRED+55;
STOPR;FL;
Delay_ms(300); // doprava
STOPR; STOPL;
While(true);
uhel=STRED;
FR;FL;
Delay_ms(250); // rovne
uhel=STRED+80;
FL;STOPR;
Delay_ms(300); // doprava
uhel=STRED;
FR;FL;
Delay_ms(100); // rovne
STOPR; STOPL;
While(true);
/* uhel=STRED;
sensors=0b00001000;
Delay_ms(1000);
FL;FR;*/
}