Adrien Audouard / SliderPartition

Dependents:   JeSuisUnGrandHomme

Fork of info1 by Guillaume Alli

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers info1.cpp Source File

info1.cpp

00001 #include "mbed.h"
00002 #include "TSISensor.h"
00003 
00004 
00005 TSISensor tsi2;
00006 
00007 void appui_num(int *bp)
00008 {
00009     if (tsi2.readPercentage()>0)
00010         *bp=1;
00011     else
00012         *bp=0;
00013 }
00014 
00015 void appui_ana (int *bp1,int *bp2,float seuil)
00016 {
00017     
00018     
00019     if (tsi2.readPercentage()>0 && tsi2.readPercentage()<seuil)
00020     {
00021         *bp1=1;
00022         *bp2=0;
00023     }
00024     
00025     else if (tsi2.readPercentage()>=seuil && tsi2.readPercentage()<=1)
00026     {
00027         *bp1=0;
00028         *bp2=1;
00029     }
00030     else
00031     {
00032         *bp1=0;
00033         *bp2=0;
00034     }
00035 }    
00036 
00037 void appui_ana_2 (int *bp1,int *bp2,int *bp3, int *bp4)
00038 {
00039     float seuil = 0.5;
00040     
00041     if (tsi2.readPercentage()>0 && tsi2.readPercentage()<0.15 )
00042     {
00043         *bp1=1;
00044         *bp2=0;
00045         *bp3=0;
00046         *bp4=0;
00047     }
00048     
00049     else if (tsi2.readPercentage()>=0.15 && tsi2.readPercentage()<= seuil )
00050     {
00051         *bp1=0;
00052         *bp2=1;
00053         *bp3=0;
00054         *bp4=0;
00055     }
00056     else if (tsi2.readPercentage()>seuil  && tsi2.readPercentage()<= 0.95)
00057     {
00058         *bp1=0;
00059         *bp2=0;
00060         *bp3=1;
00061         *bp4=0;
00062     }
00063     else if (tsi2.readPercentage()>0.95  && tsi2.readPercentage()<= 1)
00064     {
00065         *bp1=0;
00066         *bp2=0;
00067         *bp3=0;
00068         *bp4=1;
00069     }
00070     else
00071     {
00072         *bp1=0;
00073         *bp2=0;
00074         *bp3=0;
00075         *bp4=0;
00076     }
00077 }