Thermometer

Dependencies:   TextLCD mbed

main.cpp

Committer:
shingo_n
Date:
2011-05-09
Revision:
0:3a2b2c8eb1dc

File content as of revision 0:3a2b2c8eb1dc:

//
// Thermometer for LM35DZ with Starboard Orange
// 

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

TextLCD lcd(p24, p26, p27, p28, p29, p30); // rs, e, d4-d7
AnalogIn ain(p15);
Serial pc(USBTX,USBRX);

int main() {
    float temp;
    
    //initialize
    pc.baud(19200);                 //19200bps    
 
    //main loop   
    while(1){
        temp = ain * 330;
        
        pc.printf("Temp: %2.2f\n",temp);
        lcd.locate(0,0);
        lcd.printf("Temp: %2.2f",temp);

        wait(1.0);
    }
}