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.
MyPwm.cpp@0:728d17af5d23, 2018-06-22 (annotated)
- Committer:
- martwerl
- Date:
- Fri Jun 22 11:04:29 2018 +0000
- Revision:
- 0:728d17af5d23
TINF_MyPwm
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| martwerl | 0:728d17af5d23 | 1 | #include "mbed.h" |
| martwerl | 0:728d17af5d23 | 2 | #include "MyPwm.h" |
| martwerl | 0:728d17af5d23 | 3 | |
| martwerl | 0:728d17af5d23 | 4 | void MyPwm::dimUp(void) |
| martwerl | 0:728d17af5d23 | 5 | { |
| martwerl | 0:728d17af5d23 | 6 | while(_pin != 1) |
| martwerl | 0:728d17af5d23 | 7 | { |
| martwerl | 0:728d17af5d23 | 8 | _pin = _pin + 0.1; |
| martwerl | 0:728d17af5d23 | 9 | printStatus(); |
| martwerl | 0:728d17af5d23 | 10 | wait_ms(500); |
| martwerl | 0:728d17af5d23 | 11 | } |
| martwerl | 0:728d17af5d23 | 12 | } |
| martwerl | 0:728d17af5d23 | 13 | void MyPwm::dimDown(void) |
| martwerl | 0:728d17af5d23 | 14 | { |
| martwerl | 0:728d17af5d23 | 15 | while (_pin != 0) |
| martwerl | 0:728d17af5d23 | 16 | { |
| martwerl | 0:728d17af5d23 | 17 | _pin = _pin - 0.1; |
| martwerl | 0:728d17af5d23 | 18 | printStatus(); |
| martwerl | 0:728d17af5d23 | 19 | wait_ms(500); |
| martwerl | 0:728d17af5d23 | 20 | } |
| martwerl | 0:728d17af5d23 | 21 | } |
| martwerl | 0:728d17af5d23 | 22 | void MyPwm::printStatus(void) |
| martwerl | 0:728d17af5d23 | 23 | { |
| martwerl | 0:728d17af5d23 | 24 | printf("Led-Wert: %1.1f \n", (float)_pin); |
| martwerl | 0:728d17af5d23 | 25 | } |