Fixed Sonar
Dependencies: C12832 Servo mbed-rtos-edited mbed
Fork of NervousPuppy by
Diff: nervousPuppy.cpp
- Revision:
- 1:8fe6802d6971
- Parent:
- 0:f71b200c2f4d
- Child:
- 2:8415bea33a95
--- 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