zhouhang shao
/
test
test
motor.cpp
- Committer:
- kolanery
- Date:
- 2017-05-13
- Revision:
- 6:9f698d1b2996
- Parent:
- 2:b78dfa2afe92
File content as of revision 6:9f698d1b2996:
/* #include "motor.h" #include "mbed.h" const int ONE_MILLISECOND = 0.001; Motor::Motor(PinName curr_pwm_pin, PinName curr_dir): pwm_pin(_pwm_pin), dir(_dir){ pwm_pin(curr_pwm_pin); dir(curr_dir); pwm_pin.period(ONE_MILLISECOND); pwm_pin.write(0.1f); dir = 0; curr_speed = 0; } //Sets motor speed void Motor::speed(float speed) { curr_speed = speed; pwm_pin.write(speed); } //Sets motor speed to 0 void Motor::stop() { speed(0); } */