code de start qui marche a la fin du premier match, base pour la suite

Fork of CRAC-Strat_2017_homologation_petit_rob by CRAC Team

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers capteurs.cpp Source File

capteurs.cpp

00001 #include "peripheriques.h"
00002 
00003 AnalogIn cptGauche(p20);
00004 AnalogIn cptDroit(p19);
00005 
00006 DigitalIn pressionGauche(p23);
00007 DigitalIn pressionDroit(p24);
00008 
00009 AnalogIn telemetre(p15);
00010 
00011 //DigitalIn jack(p25);
00012 
00013 
00014 bool dataCouleurGauche(void){
00015     bool couleurOK = false;
00016     if(cptGauche.read() < 0.3){
00017         couleurOK = true;
00018     }
00019     return couleurOK;    
00020 }
00021 
00022 bool dataCouleurDroit(void){
00023     bool couleurOK = false;
00024     if(cptDroit.read() < 0.3){
00025         couleurOK = true;
00026     }
00027     return couleurOK;    
00028 }
00029 
00030 unsigned short dataTelemetre(void){
00031     float distance = telemetre.read()*3.3*1159.6-687.5+98;
00032     return (unsigned short)distance;
00033 }
00034 
00035 bool dataPressionGauche(void){
00036     if(cptGauche.read())return true;
00037     else return false;
00038 }
00039 
00040 bool dataPressionDroit(void){
00041     if(cptDroit.read())return true;
00042     else return false;
00043 }