BlinkLed automatically. This library requires RTOS.
Dependents: mpod_nhk_english mpod_picasa_photoframe mpod_nhk_english_spxml
This is a library that automatically blink LED
RTOS has been used. However, you do not need to be aware of the RTOS.
As with PwmOut, there are restrictions on the LED that you can use. See also PwmOut.
LEDを自動的に点滅させるライブラリです。
内部にRTOSを利用していますが、ユーザがそのことを意識する必要はありません。
使用できるLEDは、PwmOutと同様の制約があります。詳しくは、PwmOutを参照ください。
main.cpp
#include "mbed.h" #include "BlinkLed.h" BlinkLed led1(LED1, 0.02); BlinkLed led2(LED2, 0.04); BlinkLed led3(LED3, 0.06); BlinkLed led4(LED4, 0.08); int main() { while(1) { led1.startBlink(); Thread::wait(1000); led2.startBlink(); Thread::wait(1000); led3.startBlink(); Thread::wait(1000); led4.startBlink(); Thread::wait(10000); led1.finishBlink(); Thread::wait(1000); led2.finishBlink(); Thread::wait(1000); led3.finishBlink(); Thread::wait(1000); led4.finishBlink(); Thread::wait(1000); } }
Import library
Public Member Functions |
|
BlinkLed (PinName pin, float dutyChangeStep) | |
Constructor.
|
|
~BlinkLed () | |
Destructor.
|
|
void | startBlink () |
Start biinking.
|
|
void | finishBlink () |
Finish biinking.
|
Revision 2:1d0c09c1a8b4, committed 2012-12-24
- Comitter:
- togayan
- Date:
- Mon Dec 24 06:38:42 2012 +0000
- Parent:
- 1:54071e781f77
- Commit message:
- Add "isBlinking()" method.
Changed in this revision
BlinkLed.cpp | Show annotated file Show diff for this revision Revisions of this file |
BlinkLed.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 54071e781f77 -r 1d0c09c1a8b4 BlinkLed.cpp --- a/BlinkLed.cpp Sat Sep 01 11:08:44 2012 +0000 +++ b/BlinkLed.cpp Mon Dec 24 06:38:42 2012 +0000 @@ -27,6 +27,11 @@ pause = true; } +bool BlinkLed::isBlinking() +{ + return !pause; +} + void BlinkLed::blink(void const *argument) { BlinkLed* self = (BlinkLed*)argument;
diff -r 54071e781f77 -r 1d0c09c1a8b4 BlinkLed.h --- a/BlinkLed.h Sat Sep 01 11:08:44 2012 +0000 +++ b/BlinkLed.h Mon Dec 24 06:38:42 2012 +0000 @@ -25,6 +25,10 @@ /** Finish biinking */ void finishBlink(); + + /** Check biinking + */ + bool isBlinking(); private: /** Copy constructor