Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 5:32434b497a9b
- Parent:
- 4:60e7e1c1d1d8
- Child:
- 6:83dafe088914
--- a/main.cpp Fri May 17 09:25:04 2019 +0000 +++ b/main.cpp Fri May 17 10:19:24 2019 +0000 @@ -6,7 +6,7 @@ Serial lidar(PC_6, PC_7, 115200); // Définition des variables globales -int tableau_distance[360] = {}; +float tableau_distance[360] = {}; int compteur_tours_lidar = 0; // Défintion des pwm @@ -25,7 +25,7 @@ return norm2; } -void update_direction(int* list_lidar, float* vecteur) +void update_direction(float* list_lidar, float* vecteur) { // Fonction de mise à jour de la direction float direction[2]; @@ -85,7 +85,7 @@ return pwm; } -void afficher_lidar(int *tableau_distances) +void afficher_lidar(float *tableau_distances) { //Affiche les données du lidar dans la liaison série int angle; @@ -108,7 +108,7 @@ // pwm du LIDAR pwm_lidar.period_us(40); - pwm_lidar.pulsewidth_us(22); // vitesse fixe + pwm_lidar.pulsewidth_us(40); // vitesse fixe // pwm du Moteur pwm_moteur.period_ms(20); @@ -145,7 +145,7 @@ void interrupt_lidar_rx(void) { - int SEUIL = 15; // Seuil de qualité + int SEUIL = 0; // Seuil de qualité static uint8_t data[5],i=0; uint16_t Quality; @@ -175,12 +175,14 @@ if(Angle_d>359) Angle_d=359; if(Angle_d<0) Angle_d=0; + /* if (Quality < SEUIL) { // Fiabilisation des données du LIDAR naïve tableau_distance[Angle_d] = tableau_distance[Angle_d - 1]; } else tableau_distance[Angle_d] = Distance_d; - +*/ + tableau_distance[Angle_d] = Distance_d; } }