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
Diff: Hardwares/Motor.h
- Revision:
- 9:b72e18f80f49
- Parent:
- 8:92f6baeea027
- Child:
- 11:676ea42afd56
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Hardwares/Motor.h Mon Feb 06 21:07:52 2017 +0000 @@ -0,0 +1,39 @@ +#pragma once + +#include <mbed.h> + +#define MotorDir unsigned char +#define MDIR_Forward 1 +#define MDIR_Backward 0 + + +class Motor{ + +public: + + Motor(); + + ~Motor(); + + void Update(float deltaTime); + + void setLeftSpeed(float speed); + + void setRightSpeed(float speed); + + void setSpeeds(float speedLeft, float speedRight); + + void setLeftDirection(MotorDir dir); + + void setRightDirection(MotorDir dir); + + void setDirections(MotorDir dirL, MotorDir dirR); + +private: + DigitalOut m_dirL; + DigitalOut m_dirR; + + PwmOut m_pwmL; + PwmOut m_pwmR; + +}; \ No newline at end of file