Divide the slider into four areas
Dependents: JeSuisUnGrandHomme
Fork of info1 by
info1.cpp
- Committer:
- Ridaz
- Date:
- 2015-01-21
- Revision:
- 3:9f876f7e54c3
- Parent:
- 2:68deb4a53d73
File content as of revision 3:9f876f7e54c3:
#include "mbed.h" #include "TSISensor.h" TSISensor tsi2; void appui_num(int *bp) { if (tsi2.readPercentage()>0) *bp=1; else *bp=0; } void appui_ana (int *bp1,int *bp2,float seuil) { if (tsi2.readPercentage()>0 && tsi2.readPercentage()<seuil) { *bp1=1; *bp2=0; } else if (tsi2.readPercentage()>=seuil && tsi2.readPercentage()<=1) { *bp1=0; *bp2=1; } else { *bp1=0; *bp2=0; } } void appui_ana_2 (int *bp1,int *bp2,int *bp3, int *bp4) { float seuil = 0.5; if (tsi2.readPercentage()>0 && tsi2.readPercentage()<0.15 ) { *bp1=1; *bp2=0; *bp3=0; *bp4=0; } else if (tsi2.readPercentage()>=0.15 && tsi2.readPercentage()<= seuil ) { *bp1=0; *bp2=1; *bp3=0; *bp4=0; } else if (tsi2.readPercentage()>seuil && tsi2.readPercentage()<= 0.95) { *bp1=0; *bp2=0; *bp3=1; *bp4=0; } else if (tsi2.readPercentage()>0.95 && tsi2.readPercentage()<= 1) { *bp1=0; *bp2=0; *bp3=0; *bp4=1; } else { *bp1=0; *bp2=0; *bp3=0; *bp4=0; } }