![](/media/cache/profiles/142c65e00f4f7cf2e6c4c996e34005df.50x50_q85.jpg)
Download NHK English news podcast automatically. This application requires mpod mother board. See also http://mbed.org/users/geodenx/notebook/mpod/
Dependencies: BlinkLed HTTPClient EthernetInterface FatFileSystemCpp MSCFileSystem mbed-rtos mbed
Download NHK English news podcast automatically. This application requires mpod mother board. See also http://mbed.org/users/geodenx/notebook/mpod/
Diff: BlinkLed.cpp
- Revision:
- 4:ab3092d15121
- Parent:
- 3:07562878d3c3
--- a/BlinkLed.cpp Sun Aug 19 15:57:55 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -#include "BlinkLed.h" - -BlinkLed::BlinkLed(PinName pin, float dutyChangeStep, const char* name) : -led(pin, name), -dutyChangeStep(dutyChangeStep), -thread(0) -{ -} - -BlinkLed::~BlinkLed() -{ -} - -void BlinkLed::startBlink() -{ - if(thread == 0) - { - thread = new Thread(blink, this, osPriorityNormal, 128, NULL); - } -} - -void BlinkLed::finishBlink() -{ - if(thread != 0) - { - thread->terminate(); - delete thread; - thread = 0; - led = 0.0; - } -} - -void BlinkLed::blink(void const *argument) -{ - BlinkLed* blinkLed = (BlinkLed*)argument; - - int up = 1; - float brightness = 0.0; - while (1) { - if (up == 1 && brightness < 1.0) { - ; - } else if (up == 1 && brightness >= 1.0) { - up = 0; - } else if (up == 0 && brightness > 0) { - ; - } else if (up == 0 && brightness <= 0.0) { - up = 1; - } else { - error("LED PWM error\n"); - } - - float dutyChangeStep = blinkLed->dutyChangeStep; - if (up == 1) { - brightness += dutyChangeStep; - } else { - brightness -= dutyChangeStep; - } - blinkLed->led = brightness; - - Thread::wait(20); - } -}