poti
Dependencies: C12832_lcd mbed
Temperatur_einlesen.cpp@0:444de0e15eae, 2016-01-28 (annotated)
- Committer:
- tauchi88
- Date:
- Thu Jan 28 19:54:31 2016 +0000
- Revision:
- 0:444de0e15eae
poti
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tauchi88 | 0:444de0e15eae | 1 | #include "mbed.h" |
tauchi88 | 0:444de0e15eae | 2 | #include "C12832_lcd.h" |
tauchi88 | 0:444de0e15eae | 3 | |
tauchi88 | 0:444de0e15eae | 4 | //Poti1 und Poti2 extra einlesen ud auf 2 Zeilen am Display ausgeben |
tauchi88 | 0:444de0e15eae | 5 | //Poti1 hat die höchstmögliche Abtastfrequenz (sampletime) |
tauchi88 | 0:444de0e15eae | 6 | //Poti2 hat eine sehr niedrige Abtastfrequenz |
tauchi88 | 0:444de0e15eae | 7 | |
tauchi88 | 0:444de0e15eae | 8 | AnalogIn pot1(p19); |
tauchi88 | 0:444de0e15eae | 9 | AnalogIn pot2(p20); |
tauchi88 | 0:444de0e15eae | 10 | C12832_LCD lcd; |
tauchi88 | 0:444de0e15eae | 11 | Ticker t1, t2; |
tauchi88 | 0:444de0e15eae | 12 | bool updateLcd = true; |
tauchi88 | 0:444de0e15eae | 13 | |
tauchi88 | 0:444de0e15eae | 14 | |
tauchi88 | 0:444de0e15eae | 15 | void Pot1() |
tauchi88 | 0:444de0e15eae | 16 | { |
tauchi88 | 0:444de0e15eae | 17 | lcd.locate(0,5); |
tauchi88 | 0:444de0e15eae | 18 | lcd.printf("Port 1: %f ",pot1.read()); |
tauchi88 | 0:444de0e15eae | 19 | } |
tauchi88 | 0:444de0e15eae | 20 | |
tauchi88 | 0:444de0e15eae | 21 | void Pot2() |
tauchi88 | 0:444de0e15eae | 22 | { |
tauchi88 | 0:444de0e15eae | 23 | lcd.locate(0,15); |
tauchi88 | 0:444de0e15eae | 24 | lcd.printf("Port 2: %u ",pot2.read_u16()); |
tauchi88 | 0:444de0e15eae | 25 | } |
tauchi88 | 0:444de0e15eae | 26 | |
tauchi88 | 0:444de0e15eae | 27 | |
tauchi88 | 0:444de0e15eae | 28 | int main() { |
tauchi88 | 0:444de0e15eae | 29 | |
tauchi88 | 0:444de0e15eae | 30 | lcd.cls(); |
tauchi88 | 0:444de0e15eae | 31 | |
tauchi88 | 0:444de0e15eae | 32 | t1.attach(&Pot1, 1.00); |
tauchi88 | 0:444de0e15eae | 33 | t2.attach(&Pot2, 0.10); |
tauchi88 | 0:444de0e15eae | 34 | |
tauchi88 | 0:444de0e15eae | 35 | while(1) |
tauchi88 | 0:444de0e15eae | 36 | { |
tauchi88 | 0:444de0e15eae | 37 | if (updateLcd) |
tauchi88 | 0:444de0e15eae | 38 | updateLcd = false; |
tauchi88 | 0:444de0e15eae | 39 | |
tauchi88 | 0:444de0e15eae | 40 | |
tauchi88 | 0:444de0e15eae | 41 | |
tauchi88 | 0:444de0e15eae | 42 | |
tauchi88 | 0:444de0e15eae | 43 | } |
tauchi88 | 0:444de0e15eae | 44 | } |