This will control the brightness of the red led using the capacitive touch sensor present onboard the KL25Z board.
main.cpp@0:19967d57a803, 2018-06-27 (annotated)
- Committer:
- animesh44
- Date:
- Wed Jun 27 04:33:54 2018 +0000
- Revision:
- 0:19967d57a803
This will control the brightness of the red led using the capacitive touch sensor present onboard the KL25Z board.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
animesh44 | 0:19967d57a803 | 1 | #include "mbed.h" |
animesh44 | 0:19967d57a803 | 2 | #include "TSISensor.h" |
animesh44 | 0:19967d57a803 | 3 | |
animesh44 | 0:19967d57a803 | 4 | |
animesh44 | 0:19967d57a803 | 5 | int main() { |
animesh44 | 0:19967d57a803 | 6 | TSISensor tsi; |
animesh44 | 0:19967d57a803 | 7 | PwmOut myled(LED1); |
animesh44 | 0:19967d57a803 | 8 | while(1) { |
animesh44 | 0:19967d57a803 | 9 | myled = 1-tsi.readPercentage(); |
animesh44 | 0:19967d57a803 | 10 | wait(0.1); |
animesh44 | 0:19967d57a803 | 11 | } |
animesh44 | 0:19967d57a803 | 12 | } |