pwmに使うやつ
Revision 0:75de86f370c3, committed 2014-10-27
- Comitter:
- 11ee111
- Date:
- Mon Oct 27 06:40:39 2014 +0000
- Commit message:
- pwm
Changed in this revision
pwm.cpp | Show annotated file Show diff for this revision Revisions of this file |
pwm.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 75de86f370c3 pwm.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pwm.cpp Mon Oct 27 06:40:39 2014 +0000 @@ -0,0 +1,14 @@ +#include "pwm.h" +#include "mbed.h" +PWM::PWM(PinName pin):_pin(pin) { +_pin=0; +} +void PWM::ON() { +_pin=1; +} +void PWM::OFF() { +_pin=0; +} +void PWM::SWAP() { +_pin=!_pin; +} \ No newline at end of file
diff -r 000000000000 -r 75de86f370c3 pwm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pwm.h Mon Oct 27 06:40:39 2014 +0000 @@ -0,0 +1,13 @@ +#ifndef MBED_LED_H +#define MBED_LED_H +#include "mbed.h" +class PWM { +public: +PWM(PinName pin); +void ON(); +void OFF(); +void SWAP(); +private: +PwmOut _pin; +}; +#endif \ No newline at end of file