温度センサ値 XBee送信

Dependencies:   TextLCD mbed

Fork of TEMP_XBEE by toshio masuda

main.cpp

Committer:
MasudaToshio
Date:
2013-05-23
Revision:
1:8cbb7db0ff4b
Parent:
0:0d5de68f4483

File content as of revision 1:8cbb7db0ff4b:

#include "mbed.h"
#include "TextLCD.h"

AnalogIn    LM60(p15);
TextLCD     lcd(p24, p26, p27, p28, p29, p30);
Serial      xbee(p13, p14); // tx, rx

/////////////////////////////////////////////////////
//      main
/////////////////////////////////////////////////////
int main(void) {
        float a_in , tempC ;
    lcd.cls();

    while(1) {
        a_in = (LM60);
        tempC = (  ( a_in * 3.3 ) - 0.424  ) * 160.0 ;
        lcd.locate(0,0);
        lcd.printf("%5.2F C %5.3F V ", tempC, a_in);

        xbee.printf( "c" ) ;
        wait(.2);
        xbee.printf("%5.2F C %5.3F V ", tempC, a_in);
        wait(2);
    }

    return 0;
}