Autonomous line tracking with bump sensor

Fork of SeeedShieldBot by Components

Files at this revision

API Documentation at this revision

Comitter:
omarrasheedk
Date:
Thu Aug 20 21:45:07 2015 +0000
Parent:
8:9fd1722259a1
Commit message:
Selfdriving car;

Changed in this revision

SeeedStudioShieldBot.cpp Show annotated file Show diff for this revision Revisions of this file
SeeedStudioShieldBot.h Show annotated file Show diff for this revision Revisions of this file
--- a/SeeedStudioShieldBot.cpp	Thu Jul 31 14:42:21 2014 +0000
+++ b/SeeedStudioShieldBot.cpp	Thu Aug 20 21:45:07 2015 +0000
@@ -160,3 +160,9 @@
     stopLeft();
     stopRight();
 }
+
+int* SeeedStudioShieldBot::get_IR()
+{
+    int sensors[5] = {rightSensor.read(), inRightSensor.read(), centreSensor.read(), inLeftSensor.read(), leftSensor.read()};  
+    return sensors;  
+}
\ No newline at end of file
--- a/SeeedStudioShieldBot.h	Thu Jul 31 14:42:21 2014 +0000
+++ b/SeeedStudioShieldBot.h	Thu Aug 20 21:45:07 2015 +0000
@@ -103,6 +103,11 @@
          */
         float line_position();
         
+        /** Returns the values read by the sensors from Right to Left
+        *   @return array of int giving the values read by the IR sensors
+        */
+        int* get_IR();
+        
         DigitalIn rightSensor;
         DigitalIn inRightSensor;
         DigitalIn centreSensor;