C++ coding required for line follower robot

Status
Not open for further replies.

makkhan

Newbie level 3
Joined
Aug 30, 2013
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
17


Line Width is 3cm
Line Color: White
Floor Color: Blue

I want the C++ coding of the Line follower robot w.r.t the above image (track) in 8051 or PIC microcontroller with IR sensors.
 

Hello!

Apparently today is the lazy people day.
1. As just replied in another post, we are not here to write your code, do your work, etc...

2. What you are asking is simply not possible. We don't know what sensor you are using, we don't know
what kind of interface you use to the motors, etc...

What you should do first:
1. Write a simple application that allows you to switch your motor on and off, possibly at a given speed.
example:

Code C - [expand]
1
2
3
4
5
6
7
class Motor {
public:
    // Constructor, destructor, etc...
    Run(int8 speed); // You may decide that >0 is forwards and <0 is backwards, 0 is stop.
protected:
private:
}


Then test it.

Code C - [expand]
1
2
3
4
5
6
7
8
9
#define SPEED 20
Motor M;
main() {
    M.Run(SPEED);
    // Breakpoint here
    M.Run(0);
    // Breakpoint here
   M.Run(-SPEED);
}



2.Now you also need to care about the direction. It depends on how you want to turn.
It's possible with 2 motors, 1 for each motored wheel, and play with the speed difference. Or you
may also use a servo for the direction...

3. Similiarily, write a driver for your sensor (or sensor array in case you use multiple optical receivers).
I would try to write a method like EstimateDir, that would estimate the direction of the line.
This can be very tricky, epecially if one crossing road is not exactly perpendicular.
But try to solve one problem at a time. If you write everything at once, it will probably never work.

Have fun!


Dora.
 

hey double lazyyyyyyyyyy.

you dont know this. thats fine puppy.:-o
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…