Initial version
Dependencies: mbed
main.cpp@0:6637f9cf2dc0, 2015-09-29 (annotated)
- Committer:
- noutram
- Date:
- Tue Sep 29 11:18:49 2015 +0000
- Revision:
- 0:6637f9cf2dc0
Initial version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
noutram | 0:6637f9cf2dc0 | 1 | #include "mbed.h" |
noutram | 0:6637f9cf2dc0 | 2 | |
noutram | 0:6637f9cf2dc0 | 3 | PwmOut mypwm(PWM_OUT); |
noutram | 0:6637f9cf2dc0 | 4 | |
noutram | 0:6637f9cf2dc0 | 5 | DigitalOut myled(LED1); |
noutram | 0:6637f9cf2dc0 | 6 | |
noutram | 0:6637f9cf2dc0 | 7 | int main() { |
noutram | 0:6637f9cf2dc0 | 8 | |
noutram | 0:6637f9cf2dc0 | 9 | mypwm.period_ms(10); |
noutram | 0:6637f9cf2dc0 | 10 | mypwm.pulsewidth_ms(1); |
noutram | 0:6637f9cf2dc0 | 11 | |
noutram | 0:6637f9cf2dc0 | 12 | printf("pwm set to %.2f %%\n", mypwm.read() * 100); |
noutram | 0:6637f9cf2dc0 | 13 | |
noutram | 0:6637f9cf2dc0 | 14 | while(1) { |
noutram | 0:6637f9cf2dc0 | 15 | myled = !myled; |
noutram | 0:6637f9cf2dc0 | 16 | wait(1); |
noutram | 0:6637f9cf2dc0 | 17 | } |
noutram | 0:6637f9cf2dc0 | 18 | } |