void autom_20ms (void) { static uint8_t compteur_checkup_ax12 = 0; //fonction qui definit les actions switch (FLAG_ACTION) { case NE_RIEN_FAIRE: break; default : break; } // Rotation des us pour la détection adversaire if (EVITEMENT_ADV.actif == true && EVITEMENT_ADV.detection == OFF) { if (EVITEMENT_ADV.sens == MARCHE_AVANT) rotation_us_avant(); else rotation_us(); } //else //position standart // Checkup que les ax12 vont bien toutes les 500 ms compteur_checkup_ax12++; if (compteur_checkup_ax12 == 25) // 500 ms { checkup_com_ax12(); } }
float Tachometer::rpm() { unsigned int temp = rotation_us(); if (temp == 0.0) return 0.0; return ((US_PER_SECOND * 60.0) / temp); }