Divide the slider into four areas
Dependents: JeSuisUnGrandHomme
Fork of info1 by
info1.cpp@3:9f876f7e54c3, 2015-01-21 (annotated)
- Committer:
- Ridaz
- Date:
- Wed Jan 21 09:35:50 2015 +0000
- Revision:
- 3:9f876f7e54c3
- Parent:
- 2:68deb4a53d73
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Agachon | 0:432cc3112901 | 1 | #include "mbed.h" |
Agachon | 0:432cc3112901 | 2 | #include "TSISensor.h" |
Agachon | 0:432cc3112901 | 3 | |
Agachon | 0:432cc3112901 | 4 | |
Agachon | 0:432cc3112901 | 5 | TSISensor tsi2; |
Agachon | 0:432cc3112901 | 6 | |
Agachon | 1:6bd5a7965b66 | 7 | void appui_num(int *bp) |
Agachon | 0:432cc3112901 | 8 | { |
Agachon | 0:432cc3112901 | 9 | if (tsi2.readPercentage()>0) |
Agachon | 1:6bd5a7965b66 | 10 | *bp=1; |
Agachon | 0:432cc3112901 | 11 | else |
Agachon | 1:6bd5a7965b66 | 12 | *bp=0; |
Agachon | 0:432cc3112901 | 13 | } |
Agachon | 0:432cc3112901 | 14 | |
Agachon | 1:6bd5a7965b66 | 15 | void appui_ana (int *bp1,int *bp2,float seuil) |
Agachon | 0:432cc3112901 | 16 | { |
Agachon | 2:68deb4a53d73 | 17 | |
Agachon | 2:68deb4a53d73 | 18 | |
Agachon | 1:6bd5a7965b66 | 19 | if (tsi2.readPercentage()>0 && tsi2.readPercentage()<seuil) |
Agachon | 0:432cc3112901 | 20 | { |
Agachon | 1:6bd5a7965b66 | 21 | *bp1=1; |
Agachon | 1:6bd5a7965b66 | 22 | *bp2=0; |
Agachon | 0:432cc3112901 | 23 | } |
Agachon | 0:432cc3112901 | 24 | |
Agachon | 2:68deb4a53d73 | 25 | else if (tsi2.readPercentage()>=seuil && tsi2.readPercentage()<=1) |
Agachon | 0:432cc3112901 | 26 | { |
Agachon | 1:6bd5a7965b66 | 27 | *bp1=0; |
Agachon | 1:6bd5a7965b66 | 28 | *bp2=1; |
Agachon | 0:432cc3112901 | 29 | } |
Agachon | 2:68deb4a53d73 | 30 | else |
Agachon | 2:68deb4a53d73 | 31 | { |
Agachon | 2:68deb4a53d73 | 32 | *bp1=0; |
Agachon | 2:68deb4a53d73 | 33 | *bp2=0; |
Agachon | 2:68deb4a53d73 | 34 | } |
Agachon | 1:6bd5a7965b66 | 35 | } |
Ridaz | 3:9f876f7e54c3 | 36 | |
Ridaz | 3:9f876f7e54c3 | 37 | void appui_ana_2 (int *bp1,int *bp2,int *bp3, int *bp4) |
Ridaz | 3:9f876f7e54c3 | 38 | { |
Ridaz | 3:9f876f7e54c3 | 39 | float seuil = 0.5; |
Ridaz | 3:9f876f7e54c3 | 40 | |
Ridaz | 3:9f876f7e54c3 | 41 | if (tsi2.readPercentage()>0 && tsi2.readPercentage()<0.15 ) |
Ridaz | 3:9f876f7e54c3 | 42 | { |
Ridaz | 3:9f876f7e54c3 | 43 | *bp1=1; |
Ridaz | 3:9f876f7e54c3 | 44 | *bp2=0; |
Ridaz | 3:9f876f7e54c3 | 45 | *bp3=0; |
Ridaz | 3:9f876f7e54c3 | 46 | *bp4=0; |
Ridaz | 3:9f876f7e54c3 | 47 | } |
Ridaz | 3:9f876f7e54c3 | 48 | |
Ridaz | 3:9f876f7e54c3 | 49 | else if (tsi2.readPercentage()>=0.15 && tsi2.readPercentage()<= seuil ) |
Ridaz | 3:9f876f7e54c3 | 50 | { |
Ridaz | 3:9f876f7e54c3 | 51 | *bp1=0; |
Ridaz | 3:9f876f7e54c3 | 52 | *bp2=1; |
Ridaz | 3:9f876f7e54c3 | 53 | *bp3=0; |
Ridaz | 3:9f876f7e54c3 | 54 | *bp4=0; |
Ridaz | 3:9f876f7e54c3 | 55 | } |
Ridaz | 3:9f876f7e54c3 | 56 | else if (tsi2.readPercentage()>seuil && tsi2.readPercentage()<= 0.95) |
Ridaz | 3:9f876f7e54c3 | 57 | { |
Ridaz | 3:9f876f7e54c3 | 58 | *bp1=0; |
Ridaz | 3:9f876f7e54c3 | 59 | *bp2=0; |
Ridaz | 3:9f876f7e54c3 | 60 | *bp3=1; |
Ridaz | 3:9f876f7e54c3 | 61 | *bp4=0; |
Ridaz | 3:9f876f7e54c3 | 62 | } |
Ridaz | 3:9f876f7e54c3 | 63 | else if (tsi2.readPercentage()>0.95 && tsi2.readPercentage()<= 1) |
Ridaz | 3:9f876f7e54c3 | 64 | { |
Ridaz | 3:9f876f7e54c3 | 65 | *bp1=0; |
Ridaz | 3:9f876f7e54c3 | 66 | *bp2=0; |
Ridaz | 3:9f876f7e54c3 | 67 | *bp3=0; |
Ridaz | 3:9f876f7e54c3 | 68 | *bp4=1; |
Ridaz | 3:9f876f7e54c3 | 69 | } |
Ridaz | 3:9f876f7e54c3 | 70 | else |
Ridaz | 3:9f876f7e54c3 | 71 | { |
Ridaz | 3:9f876f7e54c3 | 72 | *bp1=0; |
Ridaz | 3:9f876f7e54c3 | 73 | *bp2=0; |
Ridaz | 3:9f876f7e54c3 | 74 | *bp3=0; |
Ridaz | 3:9f876f7e54c3 | 75 | *bp4=0; |
Ridaz | 3:9f876f7e54c3 | 76 | } |
Ridaz | 3:9f876f7e54c3 | 77 | } |