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ファイルの構造が変わるとうまく動かなくなります。
東電でも同様に使えると思います。
TinyHTTP_b.h
- Committer:
- okini3939
- Date:
- 2012-07-02
- Revision:
- 0:2a2f00cbc761
- Child:
- 1:10bd46941b8b
File content as of revision 0:2a2f00cbc761:
/* * mbed Tiny HTTP Client for Ethernet Interface Library * Copyright (c) 2012 Hiroshi Suga * Released under the MIT License: http://mbed.org/license/mit */ /** @file * @brief Tiny HTTP Client */ #ifndef TinyHTTP_h #define TinyHTTP_h #include "mbed.h" #include "EthernetInterface.h" #define HTTP_PORT 80 #define HTTP_TIMEOUT 15000 // ms #define METHOD_GET 0 #define METHOD_POST 1 typedef void (*onHttpReceiveFunc)(char *buf, int len); /** send http request * @param method METHOD_GET or METHOD_POST * @param host http server * @param uri URI * @param head http header (CR+LF) (or NULL) * @param body POST body (or NULL) * @return http code, -1:failue */ int httpRequest (int method, char *host, int port, char *uri, char *head, char *body, onHttpReceiveFunc func); void createauth (char *user, char *pwd, char *buf, int len); int base64enc(const char *input, unsigned int length, char *output, int len); int urlencode(char *str, char *buf, int len); #endif