Skip to content

Commit 8b84549

Browse files
committed
Finalizacion
1 parent bc7b9c1 commit 8b84549

14 files changed

+685
-483
lines changed

Programa_completo/Programa_completo.ino ControladoresFunciones/ControladoresFunciones - copia.ino

+21-25
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,23 @@ volatile int etat3 = HIGH ;
99
// Contadores de distancia de ruedas por encoder
1010
int distD=0;
1111
int distI=0;
12+
int I =0;
13+
int estado=1;
14+
int errorposicion=0, errorvelocidad=0;
1215

1316
unsigned long tiempo = 0;
1417
unsigned long t_actualizado = 0;
1518
unsigned long t_actualizado1 = 0;
1619
unsigned long t_actualizado2 = 0;
1720

21+
1822
// Control
1923
boolean avance=1;
2024
boolean colision=0;
2125
boolean marcha=0;
2226
int dis1,dis2,dis3,dis4,dis5;
27+
int dif_tiempo=0,tiempo_a=0;
28+
int vueltasqueremos=0,pa_atras=0,pa_alante=0;
2329

2430
/* Definimos cada ultrasonido*/
2531

@@ -35,35 +41,25 @@ void setup() {
3541

3642
configInterrupciones();
3743
configMotores();
44+
}
3845

39-
}
40-
4146
void loop() {
42-
tiempo = millis();
4347

44-
mover_adelante();
45-
46-
if (distD==0 && marcha)
47-
{
48-
velocidad(0);
49-
t_actualizado = tiempo;
50-
marcha=0;
51-
}
52-
if (tiempo > (t_actualizado1 + tmotoreson) && !colision)
53-
{
54-
velocidad(80);
55-
t_actualizado1 = tiempo;
56-
}
48+
tiempo = millis();
49+
Serial.println(distI);
5750

58-
if(distD>0){
59-
marcha=1;
60-
}
61-
// Apagamos el motor y esperamos 5 seg
62-
if (tiempo > (t_actualizado2 + tsensores))
63-
{
64-
leer_sensores();
65-
t_actualizado2 = tiempo;
66-
}
51+
switch(estado){
52+
case 1:
53+
vueltasqueremos=3;
54+
control(vueltasqueremos);
55+
delay(100);
56+
break;
57+
case 2:
58+
vueltasqueremos=0;
59+
control(vueltasqueremos);
60+
delay(100);
61+
break;
62+
}
6763
}
6864

6965

DosEncoders/funciones.ino

-278
This file was deleted.

PROYECTO.pptx

754 KB
Binary file not shown.

0 commit comments

Comments
 (0)