The FollowMeBot follows the user based on the color of his or her shirt. The device hosts a webcam on a servo to find the object and orient the robot. The color is chosen through the user interface with push buttons. Currently, the MATLAB code supports red and green detection. The purpose of FollowMeBot is to be able to follow the user in order to be helpful for daily tasks.

Dependencies:   Rectangle Servo TextLCD mbed

Fork of FollowMeBot3 by Rahul Shetty

Files at this revision

API Documentation at this revision

Comitter:
dhamilton31
Date:
Fri Dec 06 18:04:28 2013 +0000
Parent:
5:5fe2f8603be8
Child:
7:41b5307e4c03
Commit message:
added pushbuttons and leds

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show diff for this revision Revisions of this file
mbed.lib Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Dec 06 16:59:07 2013 +0000
+++ b/main.cpp	Fri Dec 06 18:04:28 2013 +0000
@@ -21,6 +21,8 @@
 // Hardware sensors and devices
 DigitalOut myled(LED1);
 DigitalOut myled2(LED2);
+DigitalOut greenLED(p29);
+DigitalOut redLED(p28);
 iRobot followMeBot(p9, p10);
 Servo servoHor(p22);
 Servo servoVer(p21);
@@ -29,6 +31,7 @@
 //AnalogIn irSensorRight(p18);
 Serial pc(USBTX, USBRX); // tx, rx
 TextLCD lcd(p14, p16, p17, p18, p19, p20); // rs, e, d4-d7
+InterruptIn colorPB(p30);
 
 //float irVal = irSensorFront;
 
@@ -41,18 +44,22 @@
                     (MAX_VIEW_X/2)+CENTER_BOX_TOLLERANCE,(MAX_VIEW_Y/2)+CENTER_BOX_TOLLERANCE); // Creates a box to examine if the camera is well enough centered
 int noColorCounter; // Counts how long it has been since we have seen a color to follow
 bool colorLost = true; // boolean to represent if the color is confirmed "lost" (aka noColorCounter > NO_COLOR_MAX_COUNT)
+#define GREEN 0
+#define RED 1
+char color = GREEN; // Current color selected by the pushbutton
 
 // Function Prototypes
 void getXYpos();
 float moveCamera();
 void moveBot();
 int servoIsInHome();
+void colorSelect();
 
 int main()
 {
     followMeBot.start();
     servoHor = .5;
-
+    colorPB.fall(&colorSelect);
     while(1) {
         getXYpos();
         moveBot();
@@ -192,3 +199,16 @@
         return 0;
     }
 }
+
+void colorSelect(){
+    color = !color;
+    pc.putc(color);
+    if(color == GREEN){
+        greenLED = 1;
+        redLED = 0;
+    }
+    else{
+        greenLED = 0;
+        redLED = 1;
+    }
+}
--- a/mbed.bld	Fri Dec 06 16:59:07 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.lib	Fri Dec 06 18:04:28 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/#4096f863f923