testgsosg / Mbed 2 deprecated LCD_Temp_Sensor

Dependencies:   TextLCD mbed

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 
00004 TextLCD lcd(PA_9, PC_7, PB_5, PB_4, PB_10, PA_8); // rs, e, d4-d7  //// wird benötigt fur LCD Display
00005 DigitalIn button(USER_BUTTON);
00006 AnalogIn adc0 (PA_0);
00007 AnalogIn temp (PC_2);
00008 
00009 int main()
00010 {
00011 
00012 
00013 
00014 lcd.cls();
00015 lcd.locate(0,0);
00016            // command mode
00017 wait(0.015); 
00018 
00019 float value=0;
00020 
00021 float messwert=0;
00022 lcd.locate(0,0);
00023 lcd.printf("Temperatur");
00024 
00025  
00026 while(1) 
00027 {
00028 float valuenew=0;
00029 
00030 for(int index=100; index>0; index--)
00031 
00032 { 
00033     value = temp.read();
00034     
00035     
00036     
00037     valuenew = valuenew+value;
00038 
00039     
00040 }  
00041     
00042        
00043 
00044    
00045         
00046       
00047         messwert= 3.3*valuenew/100*100; // V in Temp
00048                     
00049         lcd.locate(0,1);
00050         lcd.printf("Value %2f ",messwert);
00051         
00052          wait(1);
00053    
00054     
00055             
00056                
00057     }
00058     }
00059 
00060