![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
A program that allows the RenBuggy to detect the direction of a light source and drive towards it.
ServoDrive.h@0:575ce3f4b7ec, 2016-03-11 (annotated)
- Committer:
- RenBuggy
- Date:
- Fri Mar 11 10:39:05 2016 +0000
- Revision:
- 0:575ce3f4b7ec
version 1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RenBuggy | 0:575ce3f4b7ec | 1 | /********************************************************* |
RenBuggy | 0:575ce3f4b7ec | 2 | *ServoDrive.h * |
RenBuggy | 0:575ce3f4b7ec | 3 | *Author: Elijah Orr * |
RenBuggy | 0:575ce3f4b7ec | 4 | * * |
RenBuggy | 0:575ce3f4b7ec | 5 | *A library of functions that can be used to control the * |
RenBuggy | 0:575ce3f4b7ec | 6 | *RenBuggy via a servo motor. * |
RenBuggy | 0:575ce3f4b7ec | 7 | *********************************************************/ |
RenBuggy | 0:575ce3f4b7ec | 8 | |
RenBuggy | 0:575ce3f4b7ec | 9 | /* include guards are used to prevent problems caused by |
RenBuggy | 0:575ce3f4b7ec | 10 | multiple definitions */ |
RenBuggy | 0:575ce3f4b7ec | 11 | #ifndef SERVODRIVE_H |
RenBuggy | 0:575ce3f4b7ec | 12 | #define SERVODRIVE_H |
RenBuggy | 0:575ce3f4b7ec | 13 | |
RenBuggy | 0:575ce3f4b7ec | 14 | /* mbed.h must be included in this file also */ |
RenBuggy | 0:575ce3f4b7ec | 15 | #include "mbed.h" |
RenBuggy | 0:575ce3f4b7ec | 16 | |
RenBuggy | 0:575ce3f4b7ec | 17 | /* #define is used to set the pins that will be used to control the motors. |
RenBuggy | 0:575ce3f4b7ec | 18 | Using this method means that selecting which pins are used requires only |
RenBuggy | 0:575ce3f4b7ec | 19 | changing values here, rather than in every function that contains them. */ |
RenBuggy | 0:575ce3f4b7ec | 20 | #define servoPin p10 |
RenBuggy | 0:575ce3f4b7ec | 21 | #define LeftMotorPin p5 |
RenBuggy | 0:575ce3f4b7ec | 22 | #define RightMotorPin p6 |
RenBuggy | 0:575ce3f4b7ec | 23 | |
RenBuggy | 0:575ce3f4b7ec | 24 | /* function declarations go here */ |
RenBuggy | 0:575ce3f4b7ec | 25 | extern void go(); |
RenBuggy | 0:575ce3f4b7ec | 26 | extern void stop(); |
RenBuggy | 0:575ce3f4b7ec | 27 | /* setDirection takes a variable of type float (non integer) that will represent an angle in |
RenBuggy | 0:575ce3f4b7ec | 28 | degrees. */ |
RenBuggy | 0:575ce3f4b7ec | 29 | extern int setDirection(float); |
RenBuggy | 0:575ce3f4b7ec | 30 | /* configurePWM expects two variables of type int */ |
RenBuggy | 0:575ce3f4b7ec | 31 | extern void configurePWM(int, int); |
RenBuggy | 0:575ce3f4b7ec | 32 | |
RenBuggy | 0:575ce3f4b7ec | 33 | #endif //SERVODRIVE_H |