23 lines
704 B
C++
23 lines
704 B
C++
//#include "Chassis.h"
|
|
#include <Arduino.h>
|
|
#include <HardwareSerial.h>
|
|
|
|
int Detect_adv_lire(struct detect_adv_reception_t * detect_adv_reception){
|
|
return Detect_adv_lire(detect_adv_reception, true);
|
|
}
|
|
/// @brief Lit les capteurs VL53L1X
|
|
int Detect_adv_lire(struct detect_adv_reception_t * detect_adv_reception, bool blocking){
|
|
unsigned char tampon2[14];
|
|
//(Adresse I2c, Adresse dans le registre, tampon, longueur de donnée)
|
|
error = I2C_lire_registre(I2C_SLAVE_detect_adv, 0, detect_adv_reception->distance_cm, 12);
|
|
if (error !=0){
|
|
affiche_erreur("Scan_Detect_adversaire", "Erreur I2C");
|
|
if(blocking){
|
|
while(1);
|
|
}
|
|
}else{
|
|
Serial.println("I2C OK");
|
|
}
|
|
return error;
|
|
}
|