Fixed Sonar

Dependencies:   C12832 Servo mbed-rtos-edited mbed

Fork of NervousPuppy by Sean Doyle

Files at this revision

API Documentation at this revision

Comitter:
SeanDoyle
Date:
Mon Jan 12 19:32:28 2015 +0000
Parent:
0:f71b200c2f4d
Child:
2:8415bea33a95
Commit message:
Fixed mbed-rtos lib's issues for compilation.

Changed in this revision

mbed-rtos-edited.lib Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show diff for this revision Revisions of this file
nervousPuppy.cpp Show annotated file Show diff for this revision Revisions of this file
nervousPuppy.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos-edited.lib	Mon Jan 12 19:32:28 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/mbed_official/code/mbed-rtos/#3b7770ca2984
--- a/mbed-rtos.lib	Mon Jan 12 19:05:08 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://developer.mbed.org/users/mbed_official/code/mbed-rtos/#9387d4c49609
--- a/nervousPuppy.cpp	Mon Jan 12 19:05:08 2015 +0000
+++ b/nervousPuppy.cpp	Mon Jan 12 19:32:28 2015 +0000
@@ -1,13 +1,31 @@
 #include "nervousPuppy.h"
 
 nervousPuppy::nervousPuppy(){
-    
+    bool isRunning = true;
+    while(isRunning){
+        if(isLonely()){} // MoveForward
+        else if(isScared()){} //MoveBack
+    }
+}
+
+bool nervousPuppy::isLonely(){
+    if(playerDistance > LONELY)return true;
+    else return false;    
 }
 
+bool nervousPuppy::isScared(){
+    if(playerDistance < SCARED)return true;
+    else return false;
+}
+        
+float nervousPuppy::getPlayerDistance(){
+    return playerDistance;
+}
 
-    
-int main() {
-    while(1) {
+void nervousPuppy::setPlayerDistance(float dist){
+    playerDistance = dist;
+}
 
-    }
+int main(){
+    nervousPuppy();
 }
\ No newline at end of file
--- a/nervousPuppy.h	Mon Jan 12 19:05:08 2015 +0000
+++ b/nervousPuppy.h	Mon Jan 12 19:32:28 2015 +0000
@@ -1,5 +1,4 @@
 #include "mbed.h"
-#include <iostream>
 
 #define Cos(a) cos(PI/180*(a))
 #define Sin(a) sin(PI/180*(a))
@@ -18,7 +17,7 @@
         bool isScared();
         
         float getPlayerDistance();
-        void setPlayerDistance();
+        void setPlayerDistance(float dist);
                 
     private:
         float playerDistance;