line follower - IR sensor


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2008
    Posts
    15

    Default line follower - IR sensor

    hi

    i'm using the pic16f877a for my line follower. servo motor is used to control the wheel. i'm using 3 IR to detect the black line....so how i need to write the codes using picbasic??

    'porta.0 is Right Motor
    'porta.1 is Left Motor
    'portb.0 is Right Sensor
    'portb.1 is Center Sensor
    'portb.2 is Left Sensor
    'white line = 1
    'black line = 0

    'L C R
    '0 0 0 MF
    '0 0 1 TL
    '0 1 0 MF
    '0 1 1 TL
    '1 0 0 TR
    '1 0 1 MF
    '1 1 0 TR
    '1 1 1 SC

    If (RS = 0) and (CS = 0) and (LS = 0) Then MF
    If (RS = 1) and (CS = 0) and (LS = 0) Then TL
    If (RS = 0) and (CS = 1) and (LS = 0) Then MF
    If (RS = 1) and (CS = 1) and (LS = 0) Then TL
    If (RS = 0) and (CS = 0) and (LS = 1) Then TR
    If (RS = 1) and (CS = 0) and (LS = 1) Then MF
    If (RS = 0) and (CS = 1) and (LS = 1) Then TR
    If (RS = 1) and (CS = 1) and (LS = 1) Then SC

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Hi,

    Here is a page that might get you going.
    http://www.rentron.com/Micro-Bot/IR_Nav.htm

    Use two IR instead of three, but that is all you need to follow a line.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    May 2008
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    thank you so much...this link is really useful to me...

Similar Threads

  1. Need a cheap touch sensor idea.. here it is
    By mister_e in forum Code Examples
    Replies: 20
    Last Post: - 16th April 2016, 22:42
  2. Replies: 0
    Last Post: - 2nd February 2009, 23:23
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. line follower coding
    By shirleyz in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 23rd June 2008, 13:33
  5. having problems with Hantronix 20x4 lcd
    By Rhatidbwoy in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 22nd December 2005, 12:22

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts