![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Honmaka Astro MicroControler sample PluseMotor Sample Ver 2
Fork of PulseMotor by
main.cpp
- Committer:
- Honmaka
- Date:
- 2015-01-10
- Revision:
- 1:c533a17dccc0
- Parent:
- 0:27fe3b05f1fc
File content as of revision 1:c533a17dccc0:
#include "mbed.h" PwmOut PulseMotor(p21); DigitalIn MotorSpeedSw(p5); DigitalIn MotorDirectionSw(p6); DigitalOut MotorDirectionOut(p7); int main() { MotorSpeedSw.mode(PullUp); MotorDirectionSw.mode(PullUp); //Dorection MotorDirectionOut = MotorDirectionSw; //Speed if (MotorSpeedSw == 1) { //Normal Speed PulseMotor.period_us(83140); PulseMotor.pulsewidth_us(83140/2); } else { //Half Speed PulseMotor.period_us(83140*2); PulseMotor.pulsewidth_us((83140*2)/2); } while(1) { } }