Harsha vardan
/
Line_Follower_BonW
Line Follower Robot for a black line on a white background.
Revision 0:18385b6527e2, committed 2014-01-22
- Comitter:
- Harshavardan61
- Date:
- Wed Jan 22 21:14:10 2014 +0000
- Commit message:
- Line follower for a black line on a white background
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 18385b6527e2 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Jan 22 21:14:10 2014 +0000 @@ -0,0 +1,91 @@ +/* +###################################################### +## Program Created by Harshavardan T V & Arun M S ## +###################################################### +---- harshavardan61@gmail.com & msarun003@gmail.com---- +*/ + +#include "mbed.h" + +DigitalOut led1(LED1); +DigitalOut led2(LED2); +DigitalOut led3(LED3); +DigitalOut led4(LED4); +AnalogIn left(p16); //IR Enable. +AnalogIn right(p17); //IR Enable. +DigitalOut left1(p21); +DigitalOut left2(p22); +DigitalOut right1(p23); +DigitalOut right2(p24); + + +int main() { + float l,r; + while (1) + { + l=left; //Assign Variable "p" to piezo. + r=right; //Assign Variable "i" to ir. + if(l<0.8) + { + if(r>0.8) + { + led1=1; + led2=1; + led3=0; + led4=0; + left1=1; + left2=0; + right1=0; + right2=1; + + } + else + { + led1=1; + led4=1; + led2=0; + led3=0; + left1=1; + left2=0; + right1=1; + right2=0; + } + } + else if(l>0.8) + { + if(r<0.8) + { + led4=1; + led3=1; + led1=0; + led2=0; + left1=0; + left2=1; + right1=1; + right2=0; + } + else + { + led1=1; + led4=1; + led2=0; + led3=0; + left1=1; + left2=0; + right1=1; + right2=0; + } + } + else + { + led1=1; + led4=1; + led2=0; + led3=0; + left1=1; + left2=0; + right1=1; + right2=0; + } + } +}
diff -r 000000000000 -r 18385b6527e2 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Jan 22 21:14:10 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file