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.

line follower

Status
Not open for further replies.

newbie1346

New Member
so i have a black line follower in the end of the field theres no black line only the white board so i want to make my robot go for 700 cm then turn right (90 degree turn)is't possible to code it in arduino without a sensor? and how do i do it?
 
create a counter that counts when there is no line detected... reset when line is detected ... what is the velocity of robot so you can measure how long it takes to travel that 700cm and set the timeout accordingly
 
You need to use proper identifiers. What is 120/225?

Can you turn both motors on and if so, does it go in a straight line?

Mike.
 
125 is both motor speed and 225 is the maximum speed and yes i can turn both motors at the same time and it will go straight.
 
Then turn on both motors and time how long it takes to travel 700cm and write code to turn them on that long.

Mike.
 
Do the same again, turn one motor on forward and one backward, time how long it takes to do a full circle and use 1/4 of that time in your code.

You will probably need a short delay (0.25S) between the forward and turn code.

Mike.
 
sorry mike bit im nott good dith coding lets say it takes my robot 3 seconds to do 700cm if possible can you give a code exemple
 
Code:
//turn on both motors
delay(3000);                //3 second delay
//turn off motors
delay(250);
//turn on motors - one forward - one backward
delay(500);

Mike.
 
so i have a black line follower ...
If you wrote the code for this portion of the program, I'm somewhat surprised you can't figure out the remainder (which is considerably easier) that you're asking for help with...
 
The 500 delay was just a guess as to how long it would take to turn 90 degrees.

Mike.
 
You would need a final instruction after the last delay in Pommie 's code. You need an instruction to turn both motors off.
 
How do you differentiate between an instruction and a comment in your code snippet? I assumed that the lines with hashtags were psudocode to say "do this here". If they are strictly comments that you planned on inserting into the code, your code is only a sequence of delays and will be as effective as my old boss.
 
How do you differentiate between an instruction and a comment in your code snippet? I assumed that the lines with hashtags were psudocode to say "do this here". If they are strictly comments that you planned on inserting into the code, your code is only a sequence of delays and will be as effective as my old boss.
Well, it's obviously C code. However, I've known a few people like your old boss?

Mike.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top