for mbed OS 2
Dependencies: mbed
Fork of PwmOut_HelloWorld by
main.cpp@2:51cd5763b12f, 2018-06-29 (annotated)
- Committer:
- yokotay
- Date:
- Fri Jun 29 04:51:26 2018 +0000
- Revision:
- 2:51cd5763b12f
- Parent:
- 1:5160ea45399b
test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 0:50d2b9c62765 | 1 | #include "mbed.h" |
mbedAustin | 1:5160ea45399b | 2 | |
mbed_official | 0:50d2b9c62765 | 3 | PwmOut led(LED1); |
mbedAustin | 1:5160ea45399b | 4 | |
mbed_official | 0:50d2b9c62765 | 5 | int main() { |
mbedAustin | 1:5160ea45399b | 6 | // specify period first |
yokotay | 2:51cd5763b12f | 7 | led.period(1.0f); // 4 second period |
yokotay | 2:51cd5763b12f | 8 | led.write(0.10f); // 50% duty cycle, relative to period |
mbedAustin | 1:5160ea45399b | 9 | //led = 0.5f; // shorthand for led.write() |
mbedAustin | 1:5160ea45399b | 10 | //led.pulsewidth(2); // alternative to led.write, set duty cycle time in seconds |
mbedAustin | 1:5160ea45399b | 11 | while(1); |
mbed_official | 0:50d2b9c62765 | 12 | } |