Added various bits, main reformatted. Added .get to class Servo to allow waiting for rotation before recording information.
Fork of Lab6_Basic by
Diff: Servo.h
- Revision:
- 3:b787aa49b900
- Parent:
- 2:3540e1f2f0e1
- Child:
- 8:c2f0e524696b
--- a/Servo.h Wed Aug 17 19:21:43 2016 +0000 +++ b/Servo.h Mon Sep 19 17:06:45 2016 +0000 @@ -1,6 +1,6 @@ #include "Motor.h" #include "mbed.h" - +#include "SLCD.h" #ifndef MBED_SERVO_H #define MBED_SERVO_H @@ -12,7 +12,7 @@ * #include "Motor.h" * #include "Servo.h" * Motor my_motor(P12,P13P,p11); - * Servo myservo(p21,my_motor); + * Servo my_servo(p21,my_motor); * * int main() { * @@ -26,22 +26,25 @@ * * @param pin AnalogIn pin to be feedback, motor is a Motor object from Motor.h */ - Servo(PinName pin,Motor motor); + Servo(PinName analog_input,PinName Positive, PinName Negative,PinName Speed); /** Set the servo position * * @param angle intger in degrees 0-180 to represent the full range. */ - void write(float percent); + void set(int degree); /** Read the servo current position in degrees from 0-180 * - * @param returns the current anlge of the servo - */ - int read(); + * @return returns the current anlge of the servo + */ + void move(void); + + void check(); protected: AnalogIn _feedback; + Motor _motor; }; #endif