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