PWM, ancho de pulso variable, periodo variable (lectura por puerto)
Dependencies: TSI TextLCD mbed
Revision 0:c1fa75d95078, committed 2013-11-29
- Comitter:
- avallejopo
- Date:
- Fri Nov 29 18:25:47 2013 +0000
- Commit message:
- PWM, ancho de pulso variable, periodo variable (lectura por puerto)
Changed in this revision
diff -r 000000000000 -r c1fa75d95078 TSI.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TSI.lib Fri Nov 29 18:25:47 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/vsluiter/code/TSI/#4dc2f5a3a731
diff -r 000000000000 -r c1fa75d95078 TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Fri Nov 29 18:25:47 2013 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/avallejopo/code/TextLCD/#aba8ab3dde9d
diff -r 000000000000 -r c1fa75d95078 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Nov 29 18:25:47 2013 +0000 @@ -0,0 +1,24 @@ +#include "mbed.h" +#include "TSISensor.h" +#include "TextLCD.h" + +TextLCD lcd(PTB10, PTB11, PTE2, PTE3, PTE4, PTE5); // rs, e, d4-d7 +Timer t1; +float anchop=0.5; +float periodo=100; +int main(void) { + + PwmOut led(PTA5); + TSISensor tsi; + led.pulsewidth(anchop); + led.period_ms(periodo); + + while (true) { + if(tsi.readPercentage()!=0){ + led = 1.0 - tsi.readPercentage(); + lcd.cls(); + lcd.printf("PWM=%g",tsi.readPercentage()); + } + wait(0.1); + } +}
diff -r 000000000000 -r c1fa75d95078 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Nov 29 18:25:47 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file