Katherine Ortega
/
TareaPWM-Touch
Observar la luminosidad del LED mediante cambios de posición
main.cpp@0:0721b18fcb1c, 2013-12-11 (annotated)
- Committer:
- ikortegag
- Date:
- Wed Dec 11 23:11:16 2013 +0000
- Revision:
- 0:0721b18fcb1c
Observar la luminosidad del LED mediante cambios de posici?n
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ikortegag | 0:0721b18fcb1c | 1 | #include "mbed.h" |
ikortegag | 0:0721b18fcb1c | 2 | #include "TSISensor.h" |
ikortegag | 0:0721b18fcb1c | 3 | |
ikortegag | 0:0721b18fcb1c | 4 | int main(void) { |
ikortegag | 0:0721b18fcb1c | 5 | PwmOut led(LED_GREEN); |
ikortegag | 0:0721b18fcb1c | 6 | TSISensor tsi; |
ikortegag | 0:0721b18fcb1c | 7 | |
ikortegag | 0:0721b18fcb1c | 8 | led=1;//Condicion para que el led empiece apagado |
ikortegag | 0:0721b18fcb1c | 9 | while (true) |
ikortegag | 0:0721b18fcb1c | 10 | |
ikortegag | 0:0721b18fcb1c | 11 | { |
ikortegag | 0:0721b18fcb1c | 12 | if (tsi.readPercentage()!= 0) // se asigna la condición de estar con luminosidad constante en cualquier instante |
ikortegag | 0:0721b18fcb1c | 13 | { |
ikortegag | 0:0721b18fcb1c | 14 | led = 1.0- tsi.readPercentage(); // lee la coordenada del touch |
ikortegag | 0:0721b18fcb1c | 15 | wait(0.1); // Espera de 0.1 |
ikortegag | 0:0721b18fcb1c | 16 | } |
ikortegag | 0:0721b18fcb1c | 17 | |
ikortegag | 0:0721b18fcb1c | 18 | |
ikortegag | 0:0721b18fcb1c | 19 | } |
ikortegag | 0:0721b18fcb1c | 20 | } |