ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Codigo de arduino de carro evasor de obstaculos


Enviado por   •  28 de Noviembre de 2018  •  Tutorial  •  679 Palabras (3 Páginas)  •  360 Visitas

Página 1 de 3

int MIA=5;

int MIB=6;

int MDA=9;

int MDB=10;

int vel= 255;

int estado= 'c';

int pecho = 2;

int ptrig = 3;

int duracion, distancia;

void setup() {

Serial.begin(9600);

pinMode(MIA, OUTPUT);

pinMode(MIB, OUTPUT);

pinMode(MDA, OUTPUT);

pinMode(MDB, OUTPUT);

pinMode(pecho, INPUT);

pinMode(ptrig, OUTPUT);

}

void loop()

{

digitalWrite(ptrig, HIGH);

delay(0.01);

digitalWrite(ptrig, LOW);

if (distancia <= 15 && distancia >=2) {

analogWrite(MDB, 0);

analogWrite(MIB, 0);

analogWrite(MDA, 0);

analogWrite(MIA, 0);

delay(200);

analogWrite(MDB, vel);

analogWrite(MIB, vel);

delay(500);

analogWrite(MDB, 0);

analogWrite(MIB, 0);

analogWrite(MDA, 0);

analogWrite(MIA, vel);

delay(600);

}

else{

analogWrite(MDB, 0);

analogWrite(MIB, 0);

analogWrite(MDA, vel);

analogWrite(MIA, vel);

}

}

int MIA=5;

int MIB=6;

int MDA=9;

int MDB=10;

int vel= 255;

int estado= 'c';

int pecho = 2;

int ptrig = 3;

int duracion, distancia;

void setup() {

Serial.begin(9600);

pinMode(MIA, OUTPUT);

pinMode(MIB, OUTPUT);

pinMode(MDA, OUTPUT);

pinMode(MDB, OUTPUT);

pinMode(pecho, INPUT);

pinMode(ptrig, OUTPUT);

}

void loop()

{

digitalWrite(ptrig, HIGH);

delay(0.01);

digitalWrite(ptrig, LOW);

if (distancia <= 15 && distancia >=2) {

analogWrite(MDB, 0);

analogWrite(MIB, 0);

analogWrite(MDA, 0);

analogWrite(MIA, 0);

delay(200);

analogWrite(MDB, vel);

analogWrite(MIB, vel);

delay(500);

analogWrite(MDB, 0);

analogWrite(MIB, 0);

analogWrite(MDA, 0);

analogWrite(MIA, vel);

delay(600);

}

else{

analogWrite(MDB, 0);

analogWrite(MIB, 0);

analogWrite(MDA, vel);

analogWrite(MIA, vel);

}

}

int MIA=5;

int MIB=6;

int MDA=9;

int MDB=10;

int vel= 255;

int estado= 'c';

int pecho = 2;

int ptrig = 3;

int duracion, distancia;

void setup() {

Serial.begin(9600);

pinMode(MIA, OUTPUT);

pinMode(MIB, OUTPUT);

pinMode(MDA, OUTPUT);

pinMode(MDB, OUTPUT);

pinMode(pecho, INPUT);

pinMode(ptrig, OUTPUT);

}

void loop()

{

digitalWrite(ptrig, HIGH);

delay(0.01);

digitalWrite(ptrig, LOW);

if (distancia <= 15 && distancia >=2) {

analogWrite(MDB, 0);

analogWrite(MIB, 0);

analogWrite(MDA, 0);

analogWrite(MIA, 0);

delay(200);

analogWrite(MDB, vel);

analogWrite(MIB, vel);

delay(500);

analogWrite(MDB, 0);

analogWrite(MIB, 0);

analogWrite(MDA, 0);

analogWrite(MIA, vel);

delay(600);

}

else{

analogWrite(MDB, 0);

analogWrite(MIB, 0);

analogWrite(MDA, vel);

analogWrite(MIA, vel);

}

}

int

...

Descargar como (para miembros actualizados) txt (5 Kb) pdf (45 Kb) docx (15 Kb)
Leer 2 páginas más »
Disponible sólo en Clubensayos.com