東京電力の 需要実績を表示します。

Dependencies:   EthernetInterface FiapV2 HTTPClientForSOAP TextLCD mbed-rtos mbed spxml

Fork of temp_FIAP_fetch by Yasushi TAUCHI

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "TextLCD.h"
00003 #include "EthernetInterface.h"
00004 #include "fiap.h"
00005 
00006 EthernetInterface eth;
00007 
00008 TextLCD lcd(p24, p26, p27, p28, p29, p30);
00009 DigitalOut led(LED1);
00010 char timezone[] = "+09:00";  // JST
00011 FIAP fiap("http://www.futaba-kikaku.jp/services/jyukyu.php");
00012 char ademand[7];
00013 struct fiap_element element[]= {
00014     {"http://futaba-kikaku.jp/epco/tepco/demand",ademand,NULL,NULL,NULL,NULL,NULL,NULL,timezone},
00015 };
00016 
00017 
00018 void tick(void )
00019 {
00020     float demand;
00021     led=!led;
00022     fiap.fetch_last_data(element,1);
00023     demand=atof(element[0].value);
00024     lcd.locate(0,1);
00025     lcd.printf("%02d:%02d:%02d %5.0f",element[0].hour,element[0].minute,element[0].second,demand);
00026    }
00027 
00028 int main()
00029 {
00030     eth.init(); //Use DHCP
00031     eth.connect();
00032     lcd.cls();
00033     lcd.locate(0,0);
00034     //lcd.printf("%s", eth.getIPAddress());
00035     lcd.printf("tepco demand");
00036     fiap.debug_mode=true;
00037     while(true) {
00038         tick();
00039         wait(60);
00040     }
00041 }