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.
Diff: main.cpp
- Revision:
- 1:8c488662e000
- Parent:
- 0:9eb40ee5ff41
--- a/main.cpp Fri May 31 09:41:29 2019 +0000
+++ b/main.cpp Fri May 31 11:01:18 2019 +0000
@@ -29,23 +29,19 @@
data_angles[i]=i;
}
-voiture_deltat = t.read() - t1;
+ voiture_deltat = t.read() - t1;
t1 = t.read();
int t_angle = 1090;
int t_vitesse = 1480;
- // commande des servos
+ // Initialisation de la commande des servos
pwm_servo_direction.pulsewidth_us(t_angle);
pwm_servo_vitesse.pulsewidth_us(t_vitesse);
- myled1=1;
- myled2=1;
- myled3=1;
-
while (1){
// données de la centrale inertiel
- recup_mpu9250(voiture_deltat);
+ recup_mpu9250();
// mise à jour l'angle de la voiture
voiture_angle = voiture_angle + gz*voiture_deltat;
@@ -53,22 +49,8 @@
// voiture angle = angle dans le repère du circuit
// mise à jour la vitesse de la voiture
- voiture_vitesse = voiture_vitesse + sqrt(ax*ax+ay*ay)*voiture_deltat*g; //(m)
+ //voiture_vitesse = voiture_vitesse + sqrt(ax*ax+ay*ay)*voiture_deltat*g; //(m)
- if (voiture_vitesse>1){
- myled2=1;
- }
- else{
- myled2=0;
- }
-
- if (voiture_vitesse>5){
- myled3=1;
- }
- else{
- myled3=0;
- }
-
// data_distances = Radar;
addRadar(Radar,data,prevData);
@@ -78,6 +60,7 @@
// L'actualisation ne se lance que si on a un tableau complet
if (newRadar){
+ myled2 = myled1;
myled1 =! myled1;
actualisation();
}