Kansai Electric Power usage meter (Denki-yohou)
Dependencies: mbed mbed-rtos EthernetInterface
関西電力 でんき予報メーター
関電のでんき予報のリアルタイム値(使用電力状況データ CSV )をもとに、mbedのLEDを点灯させます。
そのほかの情報はこちらへ: http://mbed.org/users/okini3939/notebook/denki-yohou/
Import programdenki-yohou_b
Kansai Electric Power usage meter (Denki-yohou)
- LED1 動作中表示
- LED2 70%以上
- LED3 85%以上
- LED4 95%以上
新しい Ethernet Interface ライブラリと、独自の Tiny HTTP クライアント ライブラリを使っています。
CSVの解析処理をはしょって改行を頼りにしているので、CSVファイルの構造が変わるとうまく動かなくなります。
東電でも同様に使えると思います。
Diff: TinyHTTP_b.cpp
- Revision:
- 1:10bd46941b8b
- Parent:
- 0:2a2f00cbc761
--- a/TinyHTTP_b.cpp Mon Jul 02 05:54:16 2012 +0000 +++ b/TinyHTTP_b.cpp Mon Jul 02 06:55:49 2012 +0000 @@ -82,6 +82,9 @@ onHttpReceive = func; if (http->connect(host, port, HTTP_TIMEOUT)) goto exit; +#ifdef DEBUG + printf("connected\r\n"); +#endif // send request if (method == METHOD_POST) { @@ -108,7 +111,10 @@ http->send(body, strlen(body), HTTP_TIMEOUT); } - // recv dummy +#ifdef DEBUG + printf("wait for response\r\n"); +#endif + // recv for (;;) { i = http->receive(buf, sizeof(buf) - 1, HTTP_TIMEOUT); if (i == 0) break;