Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@0:912333ebe623, 2018-07-06 (annotated)
- Committer:
- tobbl2210
- Date:
- Fri Jul 06 07:22:50 2018 +0000
- Revision:
- 0:912333ebe623
test
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| tobbl2210 | 0:912333ebe623 | 1 | #include "mbed.h" |
| tobbl2210 | 0:912333ebe623 | 2 | #include "TextLCD.h" |
| tobbl2210 | 0:912333ebe623 | 3 | |
| tobbl2210 | 0:912333ebe623 | 4 | TextLCD lcd(PA_9, PC_7, PB_5, PB_4, PB_10, PA_8); // rs, e, d4-d7 //// wird benötigt fur LCD Display |
| tobbl2210 | 0:912333ebe623 | 5 | DigitalIn button(USER_BUTTON); |
| tobbl2210 | 0:912333ebe623 | 6 | AnalogIn adc0 (PA_0); |
| tobbl2210 | 0:912333ebe623 | 7 | AnalogIn temp (PC_2); |
| tobbl2210 | 0:912333ebe623 | 8 | |
| tobbl2210 | 0:912333ebe623 | 9 | int main() |
| tobbl2210 | 0:912333ebe623 | 10 | { |
| tobbl2210 | 0:912333ebe623 | 11 | |
| tobbl2210 | 0:912333ebe623 | 12 | |
| tobbl2210 | 0:912333ebe623 | 13 | |
| tobbl2210 | 0:912333ebe623 | 14 | lcd.cls(); |
| tobbl2210 | 0:912333ebe623 | 15 | lcd.locate(0,0); |
| tobbl2210 | 0:912333ebe623 | 16 | // command mode |
| tobbl2210 | 0:912333ebe623 | 17 | wait(0.015); |
| tobbl2210 | 0:912333ebe623 | 18 | |
| tobbl2210 | 0:912333ebe623 | 19 | float value=0; |
| tobbl2210 | 0:912333ebe623 | 20 | |
| tobbl2210 | 0:912333ebe623 | 21 | float messwert=0; |
| tobbl2210 | 0:912333ebe623 | 22 | lcd.locate(0,0); |
| tobbl2210 | 0:912333ebe623 | 23 | lcd.printf("Temperatur"); |
| tobbl2210 | 0:912333ebe623 | 24 | |
| tobbl2210 | 0:912333ebe623 | 25 | |
| tobbl2210 | 0:912333ebe623 | 26 | while(1) |
| tobbl2210 | 0:912333ebe623 | 27 | { |
| tobbl2210 | 0:912333ebe623 | 28 | float valuenew=0; |
| tobbl2210 | 0:912333ebe623 | 29 | |
| tobbl2210 | 0:912333ebe623 | 30 | for(int index=100; index>0; index--) |
| tobbl2210 | 0:912333ebe623 | 31 | |
| tobbl2210 | 0:912333ebe623 | 32 | { |
| tobbl2210 | 0:912333ebe623 | 33 | value = temp.read(); |
| tobbl2210 | 0:912333ebe623 | 34 | |
| tobbl2210 | 0:912333ebe623 | 35 | |
| tobbl2210 | 0:912333ebe623 | 36 | |
| tobbl2210 | 0:912333ebe623 | 37 | valuenew = valuenew+value; |
| tobbl2210 | 0:912333ebe623 | 38 | |
| tobbl2210 | 0:912333ebe623 | 39 | |
| tobbl2210 | 0:912333ebe623 | 40 | } |
| tobbl2210 | 0:912333ebe623 | 41 | |
| tobbl2210 | 0:912333ebe623 | 42 | |
| tobbl2210 | 0:912333ebe623 | 43 | |
| tobbl2210 | 0:912333ebe623 | 44 | |
| tobbl2210 | 0:912333ebe623 | 45 | |
| tobbl2210 | 0:912333ebe623 | 46 | |
| tobbl2210 | 0:912333ebe623 | 47 | messwert= 3.3*valuenew/100*100; // V in Temp |
| tobbl2210 | 0:912333ebe623 | 48 | |
| tobbl2210 | 0:912333ebe623 | 49 | lcd.locate(0,1); |
| tobbl2210 | 0:912333ebe623 | 50 | lcd.printf("Value %2f ",messwert); |
| tobbl2210 | 0:912333ebe623 | 51 | |
| tobbl2210 | 0:912333ebe623 | 52 | wait(1); |
| tobbl2210 | 0:912333ebe623 | 53 | |
| tobbl2210 | 0:912333ebe623 | 54 | |
| tobbl2210 | 0:912333ebe623 | 55 | |
| tobbl2210 | 0:912333ebe623 | 56 | |
| tobbl2210 | 0:912333ebe623 | 57 | } |
| tobbl2210 | 0:912333ebe623 | 58 | } |
| tobbl2210 | 0:912333ebe623 | 59 | |
| tobbl2210 | 0:912333ebe623 | 60 |