Simply creates a servo object from a motor object, to allow the control of the angle. uses the solar panel to look for the brightest spot, then stops.

Dependencies:   mbed

Fork of Lab6_Basic by ECE 111 At Oregon State University

Revision:
0:61b18b631f94
Child:
1:aa0b85d0961c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Servo.h	Wed Aug 17 19:07:22 2016 +0000
@@ -0,0 +1,48 @@
+#include "Motor.h"
+#include "mbed.h"
+ 
+#ifndef MBED_SERVO_H
+#define MBED_SERVO_H
+ 
+/** Servo control class, based on a Motor Class object
+ *
+ * Example:
+ * @code
+ * #include "mbed.h"
+ * #include "Motor.h"
+ * #include "Servo.h"
+ * Motor my_motor(P12,P13P,p11);
+ * Servo myservo(p21,my_motor);
+ * 
+ * int main() {
+ *     
+ * }
+ * @endcode
+ */
+class Servo {
+ 
+public:
+    /** Create a servo object connected to the specified PwmOut pin
+     *
+     * @param pin AnalogIn pin to be feedback  
+     */
+    Servo(PinName pin,Motor motor);
+    
+    /** Set the servo position, normalised to it's full range
+     *
+     * @param percent an angle number in degrees 0-180 to represent the full range.
+     */
+    void write(float percent);
+    
+    /**  Read the servo current position in degrees from 0-180
+     *
+     * @param returns the current anlge of the servo  
+     */
+    int read();
+    
+protected:
+    AnalogIn _feedback;
+};
+ 
+#endif
+ 
\ No newline at end of file