Honmaka Astro MicroControler sample PluseMotor Sample Ver 3
Fork of PulseMotor2 by
main.cpp
- Committer:
- Honmaka
- Date:
- 2015-01-10
- Revision:
- 1:c533a17dccc0
- Parent:
- 0:27fe3b05f1fc
- Child:
- 2:61ec30f77bc3
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) { } }