PROGRAMA DE PRUEBA DEL PWM OPERANDO EN TIEMPO REAL. PARA PROBARLO LO HACEMOS TRABAJAR EN TIEMPO COMPARTIDO CON LA OSCILACION DEL LED ROJO Y NINGUNO DE LOS DOS PERTURBA EL OTRO, FUNCIONA MUY BIEN, USELO CON SEGURIDAD, EVIDENTEMENTE SE CUMPLE SU OPERACION EN TIEMPO REAL
main.cpp@1:9af98ee93979, 2015-09-30 (annotated)
- Committer:
- tony63
- Date:
- Wed Sep 30 07:31:27 2015 +0000
- Revision:
- 1:9af98ee93979
- Parent:
- 0:cc4327bd1c20
pwm en tiempo real se prueba oscilando led 1 y pwm en pta13 funciona ok uselo con seguridad
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tony63 | 0:cc4327bd1c20 | 1 | #include "mbed.h" |
tony63 | 0:cc4327bd1c20 | 2 | |
tony63 | 0:cc4327bd1c20 | 3 | PwmOut led(PTA13); |
tony63 | 0:cc4327bd1c20 | 4 | DigitalOut myled(LED1); |
tony63 | 0:cc4327bd1c20 | 5 | |
tony63 | 0:cc4327bd1c20 | 6 | int main() { |
tony63 | 0:cc4327bd1c20 | 7 | led.period(0.001f); // 4 second period |
tony63 | 0:cc4327bd1c20 | 8 | led.write(0.50f); |
tony63 | 0:cc4327bd1c20 | 9 | while(1){ |
tony63 | 0:cc4327bd1c20 | 10 | myled = 1; |
tony63 | 0:cc4327bd1c20 | 11 | wait(0.2); |
tony63 | 0:cc4327bd1c20 | 12 | myled = 0; |
tony63 | 0:cc4327bd1c20 | 13 | wait(0.2); |
tony63 | 0:cc4327bd1c20 | 14 | |
tony63 | 0:cc4327bd1c20 | 15 | } |
tony63 | 0:cc4327bd1c20 | 16 | } |