Programming part

Status
Not open for further replies.

gilardino

New Member
I want to program my car(microC) to turn 180deg and after that detect the line and follow the line. I tried so many times that i can only manage it by using delay.
if(a==1)
{
u_turn();
delay_ms(2000);
a=0;
}
But this has problem that it is not constant. Sometimes after turn 180deg for 2sec, it may end outside the line. I have tried to put
if(a==1)
{
u_turn();
if(Sensor=sense)
{
a=0;
}
}
But it does not work. It even stop and does not turn at all.
Anyone have suggestion?
 
Yes, I have a suggestion - you can't control a car like that.

You need to have some kind of feedback to tell the car where it is.
 
What kind of feedback i need to use? Is it H-bridge problem? Because i am using relays. Thanks.

It's up to you to try and provide some kind of feedback, you can use sensors to count wheel rotations - simple timing can't work.
 
Previously i have tried, it can work. It follow line, after dead end, it u_turn and keep following the line.
follow();
if(dead end)
{
u_turn();
}
It works perfect as it wont go out of the line. But when i assembly all the sensors, it can not be used anymore.

I can imagine using what u said to count the motor rotation. Is it accurate to count how many rotation to reach the line?
 
Previously i have tried, it can work. It follow line, after dead end, it u_turn and keep following the line.

Only by pure luck, and not accurately repeatably.


It's a LOT more accurate than doing nothing, but it relies on the wheels never slipping.
 
Thanks thanks. But it is not a pure luck. I have repeated it many times and it works. when it detects the line, it follows it and stop turning. Do you think relays is reliable and well enough to be used?
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…