Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: C12832 Servo mbed-rtos-edited mbed
Fork of NervousPuppy by
nervousPuppy.h
00001 #include "mbed.h" 00002 #include "rtos.h" 00003 #include "Servo.h" 00004 #include "C12832.h" 00005 #include <math.h> 00006 #include <string> 00007 00008 #define Cos(a) cos(PI/180*(a)) 00009 #define Sin(a) sin(PI/180*(a)) 00010 #define PI 3.1415926 00011 00012 class nervousPuppy{ 00013 public: 00014 00015 nervousPuppy(); 00016 00017 bool isLonely(); 00018 bool isScared(); 00019 bool shutdown(); 00020 00021 void detectPlayer(); 00022 float getPlayerDistance(); 00023 void setPlayerDistance(float dist); 00024 00025 float calculateAngle(string issue); 00026 void changePosition(string servo,float angle); 00027 00028 private: 00029 00030 Mutex lockForDistance; //Not sure why needed 00031 float playerDistance, playerError; 00032 bool scared, lonely; 00033 const float LONELY = 22.0f; //Placeholder number 00034 const float SCARED = 24.0f; //Placeholder number 00035 const float RADIUS = 1.75f; //Placeholder number 00036 const float SHUTDOWN = 0.0f; //Placeholder number 00037 const float PULSE_RATE = 10; //Placeholder number - Pulses per second 00038 const float SERVO_TILT_LIMIT = 45; //Placeholder number - max angle servo can tilt by 00039 const float SERVO_ROTATE_LIMIT = 45; //Placeholder number - max angle servo can rotate by 00040 };
Generated on Wed Jul 20 2022 03:33:58 by
1.7.2
