the new engineer´s / Mbed 2 deprecated 2016-01-28_TINF_Temperatur_einlesen

Dependencies:   C12832_lcd mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Temperatur_einlesen.cpp Source File

Temperatur_einlesen.cpp

00001 #include "mbed.h"
00002 #include "C12832_lcd.h"
00003 
00004 //Poti1 und Poti2 extra einlesen ud auf 2 Zeilen am Display ausgeben
00005 //Poti1 hat die höchstmögliche Abtastfrequenz (sampletime)
00006 //Poti2 hat eine sehr niedrige Abtastfrequenz
00007 
00008 AnalogIn pot1(p19);
00009 AnalogIn pot2(p20);
00010 C12832_LCD lcd;
00011 Ticker t1, t2;
00012 bool updateLcd = true;
00013 
00014 
00015 void Pot1()
00016 {
00017     lcd.locate(0,5);
00018     lcd.printf("Port 1: %f ",pot1.read());
00019     }
00020     
00021 void Pot2()
00022 {
00023     lcd.locate(0,15);
00024     lcd.printf("Port 2: %u ",pot2.read_u16());
00025     }   
00026     
00027      
00028 int main() {
00029     
00030     lcd.cls();
00031 
00032     t1.attach(&Pot1, 1.00);
00033     t2.attach(&Pot2, 0.10);
00034     
00035     while(1)
00036     {
00037         if (updateLcd) 
00038             updateLcd = false;
00039         
00040 
00041         
00042 
00043         }
00044 }