Download picasa web albums photos 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 picasa web albums photos automatically.
This application requires mpod mother board.
Picasaウェブアルバムから、自動的に写真をダウンロードして、ディジタルフォトフレームに表示します。
動作させるには mpod マザーボード が必要です。
プログラムの中で、ご自分のアルバムのRSSファイルへのURLを指定してからご利用下さい。
Diff: BlinkLed.cpp
- Revision:
- 5:66c3398a14c9
- Parent:
- 0:dfd5cfea7112
--- a/BlinkLed.cpp Fri Aug 24 17:39:24 2012 +0000
+++ b/BlinkLed.cpp Tue Aug 28 14:41:17 2012 +0000
@@ -1,62 +1,58 @@
-#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);
- }
-}
+#include "BlinkLed.h"
+
+BlinkLed::BlinkLed(PinName pin, float dutyChangeStep, const char* name) :
+led(pin, name),
+dutyChangeStep(dutyChangeStep),
+continueBlink(false),
+thread(0)
+{
+}
+
+BlinkLed::~BlinkLed()
+{
+}
+
+void BlinkLed::startBlink()
+{
+ if(continueBlink == false)
+ {
+ continueBlink = true;
+ thread = new Thread(blink, this, osPriorityNormal, 128, NULL);
+ }
+}
+
+void BlinkLed::finishBlink()
+{
+ if(continueBlink == true)
+ {
+ continueBlink = false;
+ led = 0.0;
+ thread->terminate();
+ delete thread;
+ }
+}
+
+void BlinkLed::blink(void const *argument)
+{
+ BlinkLed* blinkLed = (BlinkLed*)argument;
+
+ bool up = false;
+ float brightness = 0.0;
+ while (blinkLed->continueBlink == true)
+ {
+ if(brightness <= 0.0)
+ {
+ up = true;
+ }
+ else if(1.0 <= brightness)
+ {
+ up = false;
+ }
+
+ float dutyChangeStep = blinkLed->dutyChangeStep;
+ brightness += ((up)?(dutyChangeStep):(-dutyChangeStep));
+ blinkLed->led = brightness;
+
+ Thread::wait(20);
+ }
+}
Satoshi Togawa