Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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?
 
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.

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?

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.

Latest threads

Back
Top