+ Reply to Thread
Results 1 to 3 of 3

Thread: line follower robot program

  1. #1
    UnD3aD Newbie
    Join Date
    Feb 2005
    Posts
    36

    Default line follower robot program

    Code:
    #include <system.h>
    
    void main()
    {
    trisa = 00b;
    trisb = 111b;
    porta = 00b;
    while(1){
    switch(portb)
    {
    case 100b: porta = 10b;break;
    case 110b: porta = 10b;break;
    case 010b: porta = 11b;break;
    case 011b: porta = 01b;break;
    case 001b: porta = 01b;break;
    case 000b: porta = 00b;break;
    case 111b: porta = 00b;break;
    }
    }
    }
    
    this program will work for a line follower robot? or i should use intrerupts? i didn't build my programmer yet and i can't test it...

    trisb from line sensors and trisa to motors


  2. #2
    strombom Newbie
    Join Date
    Aug 2003
    Location
    Sweden
    Posts
    3

    Default

    it could work, but if i were you i would try to use control theory to get smooth operation:

    http://elm-chan.org/works/ltc/report.html

    /Johan

  3. #3
    forever99482 Newbie
    Join Date
    Mar 2007
    Location
    malaysia
    Posts
    37

    Default

    you should use interrupt to enable the robot to change the speed of each wheel, that way you'd get smoother turnings

+ Reply to Thread

Tags for this Thread