Home > other >  Based on tracing stm32f10c8t6 obstacle avoidance car, later will consider adding mfrc522
Based on tracing stm32f10c8t6 obstacle avoidance car, later will consider adding mfrc522

Time:09-16

Your bosses, the younger brother you encountered a difficult problem, hope to teach bosses,

Problem description: ultrasonic obstacle avoidance module, four road tracking module can be run separately; With the main function will call together the two problems,

This is a function of ultrasonic obstacle avoidance module
Void app_ultrasonic_mode (void)
{
Int Len=0;

Len=bsp_getUltrasonicDistance ();

If (Len & lt; 100)
{
Len=(under-16) bsp_getUltrasonicDistance ();
While (Len & lt; 100)
{
Car_Stop ();
Delay_ms (300);
Len=(under-16) bsp_getUltrasonicDistance ();
}
}
The else
{
Car_Run (2600);
}

}


This is a function of tracking module
Void app_LineWalking (void)
{
Int LineL1=1, LineL2=1, LineR1=1, LineR2=1;

Bsp_GetLineWalking (& amp; LineL1, & amp; LineL2, & amp; LineR1, & amp; LineR2);

If ((LineL1==LOW | | LineL2==LOW) & amp; & LineR2==LOW)
{
Car_SpinLeft (3500, 3500);
Delay_ms (80);
}
Else if (LineL1==LOW & amp; & (LineR1==LOW | | LineR2==LOW))
{
Car_SpinRight (3500, 3500);
Delay_ms (80);
}
Else if (LineL1==LOW)
{
Car_SpinLeft (3000, 3000);
delay_ms(10);
}
Else if (LineR2==LOW)
{
Car_SpinRight (3000300);
delay_ms(10);
}
Else if (LineL2==LOW & amp; & LineR1==HIGH)
{
Car_Left (2500);
}
Else if (LineL2==HIGH & amp; & LineR1==LOW)
{
Car_Right (2500);
}
Else if (LineL2==LOW & amp; & LineR1==LOW)
{
Car_Run (3000);
}
}





This is the main function
# include "stm32f10x. H"
# include "app_motor. H"
# include "app_ultrasonic. H"
# include "bsp_ultrasonic. H"
# include "app_linewalking. H"
# include "bsp_linewalking. H"
# include "BSP. H"
# include "sys. H"

Int main (void)
{
Int Len=0;
Bsp_init ();
While (1)
{
Len=bsp_getUltrasonicDistance ();
If (Len & gt; 100)
{
App_LineWalking ();
}
The else
{
Car_Stop ();//I on 3 mu
Delay_ms (80);
If (Len & gt; 100)
break;
}
}

}


Encountered situation is that the car tracking, a short while parking, parking, or have been left to ultrasonic obstacle avoidance has been useful,

Before tried to directly invoke obstacle avoidance in the while loop, tracing, cars don't turn,

CodePudding user response:

I feel there is no problem,,,,

CodePudding user response:

reference 1st floor qq_40404475 response:
I feel there is no problem,,,,

Problem is real, yes, I'd like to speak to the teacher and classmates for help, says no problem

CodePudding user response:

Can leave a contact discuss?
  • Related