Keyestudio Ks0428 Manual page 234

Table of Contents

Advertisement

www.keyestudio.com
break;
case 'X':
matrix_display(start01); //show start pattern
light_track();
break;
}}
/*****************Obstacle Avoidance Function**************/
void avoid()
{
flag = 0; //the design that enter obstacle avoidance function
while (flag == 0)
{
random2 = random(1, 100);
a = checkdistance(); //assign the front distance detected by
ultrasonic sensor to variable a
if (a < 20) //when the front distance detected is less than 20cm
{
Car_Stop(); //robot stops
delay(200); //delay in 200ms
procedure(160); //Ultrasonic platform turns left
234

Advertisement

Table of Contents
loading

Table of Contents