final project update
Dependencies: mbed
Fork of DISCO_SMT32L4_pwm_PB3 by
main.cpp@0:4860a91fb495, 2014-02-12 (annotated)
- Committer:
- bcostm
- Date:
- Wed Feb 12 15:34:26 2014 +0000
- Revision:
- 0:4860a91fb495
- Child:
- 3:9aa9bfe031bb
Initial version.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bcostm | 0:4860a91fb495 | 1 | #include "mbed.h" |
bcostm | 0:4860a91fb495 | 2 | |
bcostm | 0:4860a91fb495 | 3 | PwmOut mypwm(PWM_OUT); |
bcostm | 0:4860a91fb495 | 4 | |
bcostm | 0:4860a91fb495 | 5 | DigitalOut myled(LED1); |
bcostm | 0:4860a91fb495 | 6 | |
bcostm | 0:4860a91fb495 | 7 | int main() { |
bcostm | 0:4860a91fb495 | 8 | |
bcostm | 0:4860a91fb495 | 9 | mypwm.period_ms(10); |
bcostm | 0:4860a91fb495 | 10 | mypwm.pulsewidth_ms(1); |
bcostm | 0:4860a91fb495 | 11 | |
bcostm | 0:4860a91fb495 | 12 | printf("pwm set to %.2f %%\n", mypwm.read() * 100); |
bcostm | 0:4860a91fb495 | 13 | |
bcostm | 0:4860a91fb495 | 14 | while(1) { |
bcostm | 0:4860a91fb495 | 15 | myled = !myled; |
bcostm | 0:4860a91fb495 | 16 | wait(1); |
bcostm | 0:4860a91fb495 | 17 | } |
bcostm | 0:4860a91fb495 | 18 | } |