IEEE1888(FIAP)のFetchプログラム例です。

Dependencies:   EthernetInterface FiapV2 HTTPClientForSOAP TextLCD mbed-rtos mbed spxml

Fork of temp_FIAP 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://192.168.1.3/axis2/services/FIAPStorage");
00012 char atemp[10];
00013 struct fiap_element element[]= {
00014     {"http://csse-tech.jp/temp_tauchi",atemp,NULL,NULL,NULL,NULL,NULL,NULL,timezone},
00015 };
00016 
00017 
00018 void tick(void )
00019 {
00020     float temp;
00021     led=!led;
00022     fiap.fetch_last_data(element,1);
00023     temp=atof(element[0].value);
00024     lcd.locate(0,1);
00025     lcd.printf("%2d:%2d:%2d %4.1fDeg",element[0].hour,element[0].minute,element[0].second,temp);
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     //fiap.debug_mode=true;
00036     while(true) {
00037         tick();
00038         wait(2);
00039     }
00040 }