Daniel Vizcaya
/
Prueba_PWM
Primera clase manejo de PWM Feb/14
main.cpp@0:8df7a9369da9, 2018-02-15 (annotated)
- Committer:
- Bethory
- Date:
- Thu Feb 15 02:25:22 2018 +0000
- Revision:
- 0:8df7a9369da9
Angel Trujillo - Daniel Vizcaya
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Bethory | 0:8df7a9369da9 | 1 | #include "mbed.h" |
Bethory | 0:8df7a9369da9 | 2 | |
Bethory | 0:8df7a9369da9 | 3 | PwmOut mypwm(PA_3); |
Bethory | 0:8df7a9369da9 | 4 | |
Bethory | 0:8df7a9369da9 | 5 | DigitalOut myled(PA_5); |
Bethory | 0:8df7a9369da9 | 6 | |
Bethory | 0:8df7a9369da9 | 7 | int main() { |
Bethory | 0:8df7a9369da9 | 8 | |
Bethory | 0:8df7a9369da9 | 9 | mypwm.period_ms(20); |
Bethory | 0:8df7a9369da9 | 10 | //mypwm.pulsewidth_us(1000); |
Bethory | 0:8df7a9369da9 | 11 | |
Bethory | 0:8df7a9369da9 | 12 | |
Bethory | 0:8df7a9369da9 | 13 | while(1) { |
Bethory | 0:8df7a9369da9 | 14 | //myled = !myled; |
Bethory | 0:8df7a9369da9 | 15 | // wait(1); |
Bethory | 0:8df7a9369da9 | 16 | for (int i=1000;i<=2000;i=i+100) |
Bethory | 0:8df7a9369da9 | 17 | { |
Bethory | 0:8df7a9369da9 | 18 | mypwm.pulsewidth_us(i); |
Bethory | 0:8df7a9369da9 | 19 | wait(2); |
Bethory | 0:8df7a9369da9 | 20 | } |
Bethory | 0:8df7a9369da9 | 21 | } |
Bethory | 0:8df7a9369da9 | 22 | } |