Nicholas Outram
/
Task136
main.cpp@1:99582c31348a, 2017-07-13 (annotated)
- Committer:
- noutram
- Date:
- Thu Jul 13 14:47:15 2017 +0000
- Revision:
- 1:99582c31348a
- Parent:
- 0:6637f9cf2dc0
updated for mbed-os 5.5
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 | } |