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@11:676ea42afd56, 2017-02-07 (annotated)
- Committer:
- Bobymicjohn
- Date:
- Tue Feb 07 21:58:20 2017 +0000
- Revision:
- 11:676ea42afd56
- Child:
- 14:88302da8bff0
Finished Core, and Servo classes.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Bobymicjohn | 11:676ea42afd56 | 1 | #pragma once |
Bobymicjohn | 11:676ea42afd56 | 2 | |
Bobymicjohn | 11:676ea42afd56 | 3 | #include <mbed.h> |
Bobymicjohn | 11:676ea42afd56 | 4 | |
Bobymicjohn | 11:676ea42afd56 | 5 | namespace SW |
Bobymicjohn | 11:676ea42afd56 | 6 | { |
Bobymicjohn | 11:676ea42afd56 | 7 | class Core; |
Bobymicjohn | 11:676ea42afd56 | 8 | } |
Bobymicjohn | 11:676ea42afd56 | 9 | |
Bobymicjohn | 11:676ea42afd56 | 10 | #define SERVO_RT 1 |
Bobymicjohn | 11:676ea42afd56 | 11 | #define SERVO_LF -1 |
Bobymicjohn | 11:676ea42afd56 | 12 | |
Bobymicjohn | 11:676ea42afd56 | 13 | #define SERVO_MAX_ANGLE 19.0f |
Bobymicjohn | 11:676ea42afd56 | 14 | |
Bobymicjohn | 11:676ea42afd56 | 15 | class Servo |
Bobymicjohn | 11:676ea42afd56 | 16 | { |
Bobymicjohn | 11:676ea42afd56 | 17 | |
Bobymicjohn | 11:676ea42afd56 | 18 | public: |
Bobymicjohn | 11:676ea42afd56 | 19 | |
Bobymicjohn | 11:676ea42afd56 | 20 | Servo(SW::Core& core); |
Bobymicjohn | 11:676ea42afd56 | 21 | |
Bobymicjohn | 11:676ea42afd56 | 22 | ~Servo(); |
Bobymicjohn | 11:676ea42afd56 | 23 | |
Bobymicjohn | 11:676ea42afd56 | 24 | void Update(float deltaTime); |
Bobymicjohn | 11:676ea42afd56 | 25 | |
Bobymicjohn | 11:676ea42afd56 | 26 | void setAngle(float angle); |
Bobymicjohn | 11:676ea42afd56 | 27 | |
Bobymicjohn | 11:676ea42afd56 | 28 | //void turnRight(float angle); |
Bobymicjohn | 11:676ea42afd56 | 29 | |
Bobymicjohn | 11:676ea42afd56 | 30 | //void turnLeft(float angle); |
Bobymicjohn | 11:676ea42afd56 | 31 | |
Bobymicjohn | 11:676ea42afd56 | 32 | private: |
Bobymicjohn | 11:676ea42afd56 | 33 | |
Bobymicjohn | 11:676ea42afd56 | 34 | SW::Core& m_core; |
Bobymicjohn | 11:676ea42afd56 | 35 | |
Bobymicjohn | 11:676ea42afd56 | 36 | float m_pulseWidth; |
Bobymicjohn | 11:676ea42afd56 | 37 | |
Bobymicjohn | 11:676ea42afd56 | 38 | PwmOut m_pwm; |
Bobymicjohn | 11:676ea42afd56 | 39 | |
Bobymicjohn | 11:676ea42afd56 | 40 | Servo(); |
Bobymicjohn | 11:676ea42afd56 | 41 | |
Bobymicjohn | 11:676ea42afd56 | 42 | }; |