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
Motor.h@4:25e028102625, 2017-02-02 (annotated)
- Committer:
- Bobymicjohn
- Date:
- Thu Feb 02 23:30:41 2017 +0000
- Revision:
- 4:25e028102625
- Child:
- 8:92f6baeea027
Added motor class;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Bobymicjohn | 4:25e028102625 | 1 | #pragma once |
Bobymicjohn | 4:25e028102625 | 2 | #include "mbed.h" |
Bobymicjohn | 4:25e028102625 | 3 | |
Bobymicjohn | 4:25e028102625 | 4 | class Motor{ |
Bobymicjohn | 4:25e028102625 | 5 | |
Bobymicjohn | 4:25e028102625 | 6 | public: |
Bobymicjohn | 4:25e028102625 | 7 | |
Bobymicjohn | 4:25e028102625 | 8 | Motor(); |
Bobymicjohn | 4:25e028102625 | 9 | |
Bobymicjohn | 4:25e028102625 | 10 | ~Motor(); |
Bobymicjohn | 4:25e028102625 | 11 | |
Bobymicjohn | 4:25e028102625 | 12 | static void setLeftSpeed(int speed); |
Bobymicjohn | 4:25e028102625 | 13 | |
Bobymicjohn | 4:25e028102625 | 14 | static void setRightSpeed(int speed); |
Bobymicjohn | 4:25e028102625 | 15 | |
Bobymicjohn | 4:25e028102625 | 16 | static void setSpeeds(int speedLeft, int speedRight); |
Bobymicjohn | 4:25e028102625 | 17 | |
Bobymicjohn | 4:25e028102625 | 18 | private: |
Bobymicjohn | 4:25e028102625 | 19 | |
Bobymicjohn | 4:25e028102625 | 20 | static inline void init() |
Bobymicjohn | 4:25e028102625 | 21 | { |
Bobymicjohn | 4:25e028102625 | 22 | static bool initialized = false; |
Bobymicjohn | 4:25e028102625 | 23 | |
Bobymicjohn | 4:25e028102625 | 24 | if(!initialized) |
Bobymicjohn | 4:25e028102625 | 25 | { |
Bobymicjohn | 4:25e028102625 | 26 | initialized = true; |
Bobymicjohn | 4:25e028102625 | 27 | initializeMotor(); |
Bobymicjohn | 4:25e028102625 | 28 | } |
Bobymicjohn | 4:25e028102625 | 29 | } |
Bobymicjohn | 4:25e028102625 | 30 | |
Bobymicjohn | 4:25e028102625 | 31 | static void initializeMotor(); |
Bobymicjohn | 4:25e028102625 | 32 | |
Bobymicjohn | 4:25e028102625 | 33 | }; |