foivos Hristou
/
FRDM_slide2fade
FRDM_slide2fade
Fork of FRDM_TSI by
main.cpp@6:06e5f77ba66e, 2014-10-07 (annotated)
- Committer:
- foivosHrist
- Date:
- Tue Oct 07 23:38:55 2014 +0000
- Revision:
- 6:06e5f77ba66e
- Parent:
- 1:51b1b688179a
FRDM_slide2fade
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 0:0f00f07ebde0 | 1 | #include "mbed.h" |
chris | 1:51b1b688179a | 2 | #include "TSISensor.h" |
emilmont | 0:0f00f07ebde0 | 3 | |
foivosHrist | 6:06e5f77ba66e | 4 | |
foivosHrist | 6:06e5f77ba66e | 5 | Serial pc(USBTX,USBRX); |
foivosHrist | 6:06e5f77ba66e | 6 | |
foivosHrist | 6:06e5f77ba66e | 7 | |
emilmont | 0:0f00f07ebde0 | 8 | int main(void) { |
chris | 1:51b1b688179a | 9 | PwmOut led(LED_GREEN); |
chris | 1:51b1b688179a | 10 | TSISensor tsi; |
foivosHrist | 6:06e5f77ba66e | 11 | float percentage; |
foivosHrist | 6:06e5f77ba66e | 12 | // uint8_t distance; |
emilmont | 0:0f00f07ebde0 | 13 | |
emilmont | 0:0f00f07ebde0 | 14 | while (true) { |
foivosHrist | 6:06e5f77ba66e | 15 | percentage=tsi.readPercentage(); |
foivosHrist | 6:06e5f77ba66e | 16 | //distance=tsi.readDistance(); |
foivosHrist | 6:06e5f77ba66e | 17 | //pc.printf("distance= %d , percentage= %f %% \n",distance,percentage); |
foivosHrist | 6:06e5f77ba66e | 18 | |
foivosHrist | 6:06e5f77ba66e | 19 | led = 1.0 - percentage; |
chris | 1:51b1b688179a | 20 | wait(0.1); |
emilmont | 0:0f00f07ebde0 | 21 | } |
chris | 1:51b1b688179a | 22 | } |