Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Motor.cpp
00001 #include "Motor.h" 00002 00003 Motor::Motor(PinName enable,PinName direction,PinName step) : _enable(enable), _direction(direction), _step(step) { 00004 _enable=1; 00005 } 00006 00007 Motor::~Motor() { 00008 } 00009 00010 void Motor::motor_turn(int direction, int steps) { 00011 _enable=0; 00012 float freq=600;//frequency of PWM signal to drive stepper motor 00013 _step.period(1/freq); 00014 _step.write(.5); 00015 _direction=direction; 00016 wait(steps*(1/freq)); 00017 _step.write(0); 00018 _enable=1; 00019 }
Generated on Thu Jul 14 2022 08:04:58 by
1.7.2