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:
- 6:9af875ef7b30
- Parent:
- 5:73aac5fe9696
- Child:
- 7:20d05f0d11a2
--- a/main.cpp Thu Jun 06 14:04:56 2019 +0000
+++ b/main.cpp Thu Jun 06 16:30:59 2019 +0000
@@ -8,9 +8,9 @@
// Définition du timer global de la voiture
// Timer
-DigitalOut myled1(LED1);
DigitalOut myled2(LED2);
DigitalOut myled3(LED3);
+
Serial pc(USBTX,USBRX,115200);
float tnul = 0.0;
float t1;
@@ -60,7 +60,7 @@
voiture_deltat = t.read() - t1;
}
- while (1) { //while(start){
+ while (start) { //while(start){
// données de la centrale inertiel
// data_distances = Radar;
recuperer_start(deltat_start);
@@ -82,14 +82,13 @@
if (newRadar) {
cpt++;
newRadar = false;
- myled1 = !myled1 ;
+ myled3 = !myled3 ;
// Conversion tableau -> vector
for (int i =0; i<360; i++) {
data_distances[i]=float(Radar[i])/1000.0; // (m)
}
actualisation();
if(cpt%100==0) {
- myled3 = !myled3;
for(int i=0; i<360; i++) {
pc.printf("%3d %4.3f%\n",i,data_distances[i]);
}
@@ -110,13 +109,8 @@
}
int t_vitesse = convers_vitesse_tempsh(voiture_vitesse);
-
- if (1440 <=t_vitesse <= 1480) {
- myled3=0;
- } else {
- myled3=1;
- }
-
+ t_vitesse=1480;
+
// commande des servos
pwm_servo_direction.pulsewidth_us(t_angle);
pwm_servo_vitesse.pulsewidth_us(t_vitesse);