Create this program
Dependencies: mbed HCSR04 HMC6352 PID TextLCD
Diff: motor.h
- Revision:
- 3:901d18b901b4
- Parent:
- 2:a8bbf677e774
- Child:
- 5:e07e380ddb93
--- a/motor.h Thu Aug 06 00:19:29 2015 +0000 +++ b/motor.h Fri Aug 07 06:34:36 2015 +0000 @@ -13,6 +13,7 @@ class Motor { public: Motor(PinName normalDirect, PinName reverseDirect, PinName pwm); + ~Motor(); int setLimit(float powerLimit = 1); void setFlequency(float correctFlequency); void run(float power); // input -1 ~ 1 @@ -33,6 +34,10 @@ powerLevel = new PwmOut(pwm); } +Motor::~Motor() { + delete powerLevel; +} + // set flequency void Motor::setFlequency(float correctFlequency) { powerLevel->period(1 / correctFlequency);