Just a simple sample of TextLCD and LM35 temperature sensor (version2)

Dependencies:   mbed

main.cpp

Committer:
nxpfan
Date:
2010-08-12
Revision:
0:87b4eb4bb312

File content as of revision 0:87b4eb4bb312:

//  A simple sample to use TextLCD and LM35 temeperature sensor

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

AnalogIn    ain(p20);
TextLCD     lcd(p24, p25, p26, p27, p28, p29); // rs, e, d0-d3

int main() {
    float   ondo;
    lcd.printf("Ondokei\n");

    while (1) {
        ondo    = 0;
        
        for ( int i = 0; i < 100; i++ ) {
            ondo += ain;
            wait(0.01);
        }
        
        printf( "%f\r\n", ondo * 3.3 );
        lcd.locate( 3, 1 );
        lcd.printf( "ondo =%5.1f%cC", ondo * 3.3, 0xDF );
    }
}