0% found this document useful (0 votes)
8 views

Robot Seguidor de Lineas

Uploaded by

luis miguel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Robot Seguidor de Lineas

Uploaded by

luis miguel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

ROBOT SEGUIDOR DE LINEAS

int PwmDer=3;
int MotorDerAd=4;
int MotorDerAt=5;
int MotorIzqAd=7;
int MotorIzqAt=8;
int PwmIzq=9;

//VELOCIDAD
int VelDer=150;
int VelIzq=150;

//SENSORES INFRARROJO
int SensorDer=19;
int SensorIzq=18;

void setup() {
pinMode (PwmDer,OUTPUT);
pinMode (MotorDerAd,OUTPUT);
pinMode (MotorDerAt,OUTPUT);
pinMode (MotorIzqAd,OUTPUT);
pinMode (MotorIzqAt,OUTPUT);
pinMode (PwmIzq,OUTPUT);

pinMode (SensorIzq,INPUT);
pinMode (SensorDer,INPUT);
Serial.begin(9600);
}

void loop() {
//Para el sensor infrarrojo LOW = BLANCO HIGH = NEGRO
if(digitalRead(SensorIzq)==LOW && digitalRead(SensorDer)==LOW)
{
adelante();
}
if(digitalRead(SensorIzq)==HIGH && digitalRead(SensorDer)==LOW)
{
izquierda();
}
if(digitalRead(SensorIzq)==LOW && digitalRead(SensorDer)==HIGH)
{
derecha();
}
if(digitalRead(SensorIzq)==HIGH && digitalRead(SensorDer)==HIGH)
{
parar();
}
}
void adelante() {
analogWrite (PwmDer,VelDer);
digitalWrite (MotorDerAd,HIGH);
digitalWrite (MotorDerAt,LOW);
digitalWrite (MotorIzqAd,HIGH);
digitalWrite (MotorIzqAt,LOW);
analogWrite (PwmIzq,VelIzq);
}

void atras() {
analogWrite (PwmDer,VelDer);
digitalWrite (MotorDerAd,LOW);
digitalWrite (MotorDerAt,HIGH);
digitalWrite (MotorIzqAd,LOW);
digitalWrite (MotorIzqAt,HIGH);
analogWrite (PwmIzq,VelIzq);
}

void izquierda() {
analogWrite (PwmDer,VelDer);
digitalWrite (MotorDerAd,HIGH);
digitalWrite (MotorDerAt,LOW);
digitalWrite (MotorIzqAd,LOW);
digitalWrite (MotorIzqAt,HIGH);
analogWrite (PwmIzq,VelIzq);
}

void derecha() {
analogWrite (PwmDer,VelDer);
digitalWrite (MotorDerAd,LOW);
digitalWrite (MotorDerAt,HIGH);
digitalWrite (MotorIzqAd,HIGH);
digitalWrite (MotorIzqAt,LOW);
analogWrite (PwmIzq,VelIzq);
}

void parar() {
analogWrite (PwmDer,VelDer);
digitalWrite (MotorDerAd,LOW);
digitalWrite (MotorDerAt,LOW);
digitalWrite (MotorIzqAd,LOW);
digitalWrite (MotorIzqAt,LOW);
analogWrite (PwmIzq,VelIzq);

}
Motor Izquierda

Soldadura de motores

Puente H
ROBOT SEGUIDOR DE LINEAS

Sensor infrarrojo
TCRT5000
Motor Derecha

You might also like