line follower robot program

Status
Not open for further replies.

UnD3aD

New Member
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
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…