
This program is a PWM which varies the dutty cycle by the touchpad of FRDM KL25Z. We can observe the result with the variation of RGBled intensity
main.cpp@0:c583c613f378, 2013-12-15 (annotated)
- Committer:
- lcorralesc1
- Date:
- Sun Dec 15 15:34:21 2013 +0000
- Revision:
- 0:c583c613f378
This program is a PWM which varies the dutty cycle by the touchpad of FRDM KL25Z. We can observe the result with the variation of RGBled intensity
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lcorralesc1 | 0:c583c613f378 | 1 | #include "mbed.h" |
lcorralesc1 | 0:c583c613f378 | 2 | #include "TSISensor.h" |
lcorralesc1 | 0:c583c613f378 | 3 | |
lcorralesc1 | 0:c583c613f378 | 4 | int main(void) { |
lcorralesc1 | 0:c583c613f378 | 5 | PwmOut led(LED_GREEN); |
lcorralesc1 | 0:c583c613f378 | 6 | PwmOut Salida(PTD4); |
lcorralesc1 | 0:c583c613f378 | 7 | TSISensor tsi; |
lcorralesc1 | 0:c583c613f378 | 8 | |
lcorralesc1 | 0:c583c613f378 | 9 | while (true) { |
lcorralesc1 | 0:c583c613f378 | 10 | if (tsi.readPercentage()!=0) // Asignacion de Luminosidad del led |
lcorralesc1 | 0:c583c613f378 | 11 | { |
lcorralesc1 | 0:c583c613f378 | 12 | led = 1.0 - tsi.readPercentage(); // Coordenadas del la asignacion del led |
lcorralesc1 | 0:c583c613f378 | 13 | Salida=1.0 - tsi.readPercentage(); |
lcorralesc1 | 0:c583c613f378 | 14 | wait(0.1); // Tiempo de es espera para retomar el ciclo |
lcorralesc1 | 0:c583c613f378 | 15 | |
lcorralesc1 | 0:c583c613f378 | 16 | } |
lcorralesc1 | 0:c583c613f378 | 17 | } |
lcorralesc1 | 0:c583c613f378 | 18 | } |