SmartWheels self-driving race car. Designed for NXP Cup. Uses FRDM-KL25Z, area-scan camera, and simple image processing to detect and navigate any NXP spec track.
Dependencies: TSI USBDevice mbed-dev
Fork of SmartWheels by
Hardwares/Servo.h@91:7b1910ca3ad6, 2017-04-19 (annotated)
- Committer:
- hazheng
- Date:
- Wed Apr 19 14:54:14 2017 +0000
- Revision:
- 91:7b1910ca3ad6
- Parent:
- 46:a5eb9bd3bb55
More documentations.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hazheng | 91:7b1910ca3ad6 | 1 | /** |
hazheng | 91:7b1910ca3ad6 | 2 | * @file Servo.h |
hazheng | 91:7b1910ca3ad6 | 3 | * @brief The header file for the servo functions. |
hazheng | 91:7b1910ca3ad6 | 4 | * @author Jordan Brack <jabrack@mix.wvu.edu>, Haofan Zheng <hazheng@mix.wvu.edu> |
hazheng | 91:7b1910ca3ad6 | 5 | * |
hazheng | 91:7b1910ca3ad6 | 6 | */ |
Bobymicjohn | 11:676ea42afd56 | 7 | #pragma once |
hazheng | 91:7b1910ca3ad6 | 8 | #ifndef SERVO_H |
hazheng | 91:7b1910ca3ad6 | 9 | #define SERVO_H |
Bobymicjohn | 11:676ea42afd56 | 10 | |
Bobymicjohn | 11:676ea42afd56 | 11 | #include <mbed.h> |
Bobymicjohn | 11:676ea42afd56 | 12 | |
hazheng | 91:7b1910ca3ad6 | 13 | #define SERVO_RT 1 /*!< @brief The sign for the right turn. */ |
hazheng | 91:7b1910ca3ad6 | 14 | #define SERVO_LF -1 /*!< @brief The sign for the left turn. */ |
Bobymicjohn | 11:676ea42afd56 | 15 | |
hazheng | 91:7b1910ca3ad6 | 16 | #define SERVO_MAX_ANGLE 21.0f /*!< @brief The max angle for turnning. */ |
Bobymicjohn | 11:676ea42afd56 | 17 | |
hazheng | 45:501b7909139a | 18 | #ifdef __cplusplus |
hazheng | 45:501b7909139a | 19 | extern "C" { |
hazheng | 45:501b7909139a | 20 | #endif |
hazheng | 45:501b7909139a | 21 | |
hazheng | 91:7b1910ca3ad6 | 22 | /** |
hazheng | 91:7b1910ca3ad6 | 23 | * @brief Init the servo. There is only one servo in the system, thus, this function is required to be called only once during the system initialization. |
hazheng | 91:7b1910ca3ad6 | 24 | */ |
hazheng | 45:501b7909139a | 25 | void servo_init(); |
hazheng | 45:501b7909139a | 26 | |
hazheng | 91:7b1910ca3ad6 | 27 | /** |
hazheng | 91:7b1910ca3ad6 | 28 | * @brief Set the angle of the servo. |
hazheng | 91:7b1910ca3ad6 | 29 | * @param angle The angle in degrees. The sign determine the direction(left/right), and there is a max degree for turnning (They are defined above). |
hazheng | 91:7b1910ca3ad6 | 30 | */ |
hazheng | 45:501b7909139a | 31 | void servo_set_angle(float angle); |
hazheng | 45:501b7909139a | 32 | |
hazheng | 45:501b7909139a | 33 | #ifdef __cplusplus |
hazheng | 45:501b7909139a | 34 | } |
hazheng | 45:501b7909139a | 35 | #endif |
hazheng | 91:7b1910ca3ad6 | 36 | |
hazheng | 91:7b1910ca3ad6 | 37 | #endif //SERVO_H |