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ファイルの構造が変わるとうまく動かなくなります。
東電でも同様に使えると思います。

Committer:
okini3939
Date:
Tue Jul 03 00:32:27 2012 +0000
Revision:
3:ef5af1e8558d
Parent:
1:10bd46941b8b
bugfix and pwm drive to led

Who changed what in which revision?

UserRevisionLine numberNew contents of line
okini3939 0:2a2f00cbc761 1 /*
okini3939 0:2a2f00cbc761 2 * mbed Tiny HTTP Client for Ethernet Interface Library
okini3939 0:2a2f00cbc761 3 * Copyright (c) 2012 Hiroshi Suga
okini3939 0:2a2f00cbc761 4 * Released under the MIT License: http://mbed.org/license/mit
okini3939 0:2a2f00cbc761 5 */
okini3939 0:2a2f00cbc761 6
okini3939 0:2a2f00cbc761 7 /** @file
okini3939 0:2a2f00cbc761 8 * @brief Tiny HTTP Client
okini3939 0:2a2f00cbc761 9 */
okini3939 0:2a2f00cbc761 10
okini3939 0:2a2f00cbc761 11 #ifndef TinyHTTP_h
okini3939 0:2a2f00cbc761 12 #define TinyHTTP_h
okini3939 0:2a2f00cbc761 13
okini3939 0:2a2f00cbc761 14 #include "mbed.h"
okini3939 0:2a2f00cbc761 15 #include "EthernetInterface.h"
okini3939 0:2a2f00cbc761 16
okini3939 0:2a2f00cbc761 17 #define HTTP_PORT 80
okini3939 1:10bd46941b8b 18 #define HTTP_TIMEOUT 3000 // ms
okini3939 0:2a2f00cbc761 19
okini3939 0:2a2f00cbc761 20 #define METHOD_GET 0
okini3939 0:2a2f00cbc761 21 #define METHOD_POST 1
okini3939 0:2a2f00cbc761 22
okini3939 0:2a2f00cbc761 23 typedef void (*onHttpReceiveFunc)(char *buf, int len);
okini3939 0:2a2f00cbc761 24
okini3939 0:2a2f00cbc761 25 /** send http request
okini3939 0:2a2f00cbc761 26 * @param method METHOD_GET or METHOD_POST
okini3939 0:2a2f00cbc761 27 * @param host http server
okini3939 0:2a2f00cbc761 28 * @param uri URI
okini3939 0:2a2f00cbc761 29 * @param head http header (CR+LF) (or NULL)
okini3939 0:2a2f00cbc761 30 * @param body POST body (or NULL)
okini3939 0:2a2f00cbc761 31 * @return http code, -1:failue
okini3939 0:2a2f00cbc761 32 */
okini3939 0:2a2f00cbc761 33 int httpRequest (int method, char *host, int port, char *uri, char *head, char *body, onHttpReceiveFunc func);
okini3939 0:2a2f00cbc761 34
okini3939 0:2a2f00cbc761 35 void createauth (char *user, char *pwd, char *buf, int len);
okini3939 0:2a2f00cbc761 36
okini3939 0:2a2f00cbc761 37 int base64enc(const char *input, unsigned int length, char *output, int len);
okini3939 0:2a2f00cbc761 38
okini3939 0:2a2f00cbc761 39 int urlencode(char *str, char *buf, int len);
okini3939 0:2a2f00cbc761 40
okini3939 0:2a2f00cbc761 41 #endif