Line Follower Robot for following a white line on a black background.

Dependencies:   mbed

Line Follower Robot for following a white line on a black background.

Revision:
0:116b193a6a75
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jan 22 21:21:50 2014 +0000
@@ -0,0 +1,90 @@
+/*
+#########################################################
+##  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)
+        {
+            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 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
+    {
+        led1=1;
+        led4=1;
+        led2=0;
+        led3=0;
+        left1=1;
+        left2=0;
+        right1=1;
+        right2=0;
+        }
+    }
+}