![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
exercise 1
main.cpp@1:211adb1a2b53, 2020-10-06 (annotated)
- Committer:
- happy_alien
- Date:
- Tue Oct 06 15:58:17 2020 +0000
- Revision:
- 1:211adb1a2b53
- Parent:
- 0:01aa441bf296
Class excercise 1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
happy_alien | 1:211adb1a2b53 | 1 | |
happy_alien | 0:01aa441bf296 | 2 | #include "mbed.h" |
happy_alien | 0:01aa441bf296 | 3 | |
happy_alien | 1:211adb1a2b53 | 4 | void printStatus(void); |
happy_alien | 1:211adb1a2b53 | 5 | |
happy_alien | 1:211adb1a2b53 | 6 | class MyClass |
happy_alien | 1:211adb1a2b53 | 7 | { |
happy_alien | 1:211adb1a2b53 | 8 | public: |
happy_alien | 1:211adb1a2b53 | 9 | MyClass(double messwert):_messwert(messwert) |
happy_alien | 1:211adb1a2b53 | 10 | { |
happy_alien | 1:211adb1a2b53 | 11 | |
happy_alien | 1:211adb1a2b53 | 12 | } |
happy_alien | 1:211adb1a2b53 | 13 | |
happy_alien | 1:211adb1a2b53 | 14 | void printStatus(){ |
happy_alien | 1:211adb1a2b53 | 15 | printf("Status is now: %f\n", _messwert); |
happy_alien | 1:211adb1a2b53 | 16 | } |
happy_alien | 0:01aa441bf296 | 17 | |
happy_alien | 1:211adb1a2b53 | 18 | private: |
happy_alien | 1:211adb1a2b53 | 19 | double _messwert; |
happy_alien | 1:211adb1a2b53 | 20 | }; |
happy_alien | 1:211adb1a2b53 | 21 | |
happy_alien | 1:211adb1a2b53 | 22 | MyClass messwert(0.0); |
happy_alien | 1:211adb1a2b53 | 23 | |
happy_alien | 1:211adb1a2b53 | 24 | |
happy_alien | 1:211adb1a2b53 | 25 | |
happy_alien | 1:211adb1a2b53 | 26 | |
happy_alien | 1:211adb1a2b53 | 27 | |
happy_alien | 1:211adb1a2b53 | 28 | int main() |
happy_alien | 1:211adb1a2b53 | 29 | { |
happy_alien | 1:211adb1a2b53 | 30 | while (1) { |
happy_alien | 1:211adb1a2b53 | 31 | |
happy_alien | 1:211adb1a2b53 | 32 | messwert.printStatus(); |
happy_alien | 1:211adb1a2b53 | 33 | wait_ms(500); |
happy_alien | 1:211adb1a2b53 | 34 | |
happy_alien | 1:211adb1a2b53 | 35 | |
happy_alien | 0:01aa441bf296 | 36 | } |
happy_alien | 0:01aa441bf296 | 37 | } |