genera un PWM con ancho de pulso variable a traves del touchcapacitive integrado en la tarjeta kl25z
Dependencies: TSI TextLCD mbed
Revision 0:ae7305f55ecf, committed 2013-12-11
- Comitter:
- amarincan
- Date:
- Wed Dec 11 13:11:15 2013 +0000
- Commit message:
- se modifico una funcion private to public
Changed in this revision
diff -r 000000000000 -r ae7305f55ecf TSI.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TSI.lib Wed Dec 11 13:11:15 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/vsluiter/code/TSI/#4dc2f5a3a731
diff -r 000000000000 -r ae7305f55ecf TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Wed Dec 11 13:11:15 2013 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/simon/code/TextLCD/#44f34c09bd37
diff -r 000000000000 -r ae7305f55ecf main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Dec 11 13:11:15 2013 +0000 @@ -0,0 +1,44 @@ +#include "mbed.h" +#include "TSISensor.h" +#include "TextLCD.h" + + +float value=0,valuev=0; +TextLCD lcd(PTB10, PTB11, PTE2, PTE3, PTE4, PTE5); // rs, e, d4-d7 + +int main(void) { + + //lcd.writeCommand(0x0E); + + + PwmOut led(LED_BLUE); + PwmOut pin(PTD4); + float p=0.003; + led.period(p); + //pin.pulsewidth(p); + pin.period(p); + lcd.printf("Periodo=%gs",p); + lcd.locate(0,1); + lcd.printf("cycle duty=0"); + TSISensor tsi; + led = 1; + int d; + while (true) { + value=tsi.readPercentage(); + if(value!=valuev && value!=0) + { + + // pin = 1.0 - value; + pin.write(1.0 - value); + led.write(value); + d=(1-value)*100; + lcd.locate(0,1); + lcd.printf(" "); + lcd.locate(0,1); + lcd.printf("cycle duty=%d",d); + valuev=value; + } + // wait(0.1); + +} +} \ No newline at end of file
diff -r 000000000000 -r ae7305f55ecf mbed.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.lib Wed Dec 11 13:11:15 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/#a9913a65894f