Manufactura industrial
Internet industrial de las cosas | Materiales industriales | Mantenimiento y reparación de equipos | Programación industrial |
home  MfgRobots >> Manufactura industrial >  >> Manufacturing Technology >> Proceso de manufactura

Construye el Robot Seguidor de Línea más Simple con Arduino y SparkFun L298

Componentes y suministros

ComponenteCantidad
Arduino UNO1
Driver dual H-Bridge L298 SparkFun1
Sensor IR2
Cables jumper (genéricos)1

Herramientas y máquinas necesarias

Aplicaciones y servicios en línea

Sobre el proyecto

El robot seguidor de línea es el "Hola Mundo" de la robótica. Este seguidor de línea es muy simple, fácil de construir.

Código

Robot Seguidor de Línea Basado en Arduino (C/C++)

/*------- Definiendo Entradas ------*/
#define LS 2  // Sensor izquierdo
#define RS 5  // Sensor derecho

/*------- Definiendo Salidas ------*/
#define LM1 11 // Motor izquierdo
#define LM2 10 // Motor izquierdo
#define RM1 9  // Motor derecho
#define RM2 6  // Motor derecho

void setup() {
  pinMode(LS, INPUT);
  pinMode(RS, INPUT);
  pinMode(LM1, OUTPUT);
  pinMode(LM2, OUTPUT);
  pinMode(RM1, OUTPUT);
  pinMode(RM2, OUTPUT);
}

void loop() {
  if ((digitalRead(LS) == LOW) && (digitalRead(RS) == LOW)) // Condición 1: Avanzar
    MoveForward();
  if ((digitalRead(LS) == HIGH) && (digitalRead(RS) == HIGH)) // Condición 2: Parar
    Stop();
  if ((digitalRead(LS) == LOW) && (digitalRead(RS) == HIGH)) // Derecha
    TurnLeft();
  if ((digitalRead(LS) == HIGH) && (digitalRead(RS) == LOW)) // Izquierda
    TurnRight();
}

void MoveForward() {
  analogWrite(LM1, 50); analogWrite(LM2, 0);
  analogWrite(RM1, 50); analogWrite(RM2, 0);
  delay(20);
}

void TurnRight() {
  analogWrite(LM1, 0); analogWrite(LM2, 60);
  analogWrite(RM1, 60); analogWrite(RM2, 0);
  delay(30);
}

void TurnLeft() {
  analogWrite(LM1, 60); analogWrite(LM2, 0);
  analogWrite(RM1, 0); analogWrite(RM2, 60);
  delay(30);
}

void Stop() {
  analogWrite(LM1, 0); analogWrite(LM2, 0);
  analogWrite(RM1, 0); analogWrite(RM2, 0);
  delay(20);
}

Esquemáticos

Construye el Robot Seguidor de Línea más Simple con Arduino y SparkFun L298

Proceso de manufactura

  1. Proyecto Dados Digitales Arduino: Construye tu Propio Generador de Números Aleatorios con LCD
  2. Construye un Iron Man animado con Arduino: componentes, sensores y guía paso a paso
  3. Robot seguidor de línea V4 – Sistema avanzado con Arduino Nano y PCB a medida
  4. Find Me: Localizador Inteligente de Objetos con Arduino y Bluetooth
  5. Robot Seguidor de Línea Autónomo con Arduino UNO: Guía Paso a Paso
  6. Construye un Brazo Robótico Impreso en 3D Controlado por Arduino – Guía Paso a Paso
  7. Controlador de Humidificador DIY con Arduino y Relé: Configuración Segura de Alto Voltaje
  8. Construye un robot controlado por voz con Arduino Nano
  9. MobBob: Robot Arduino Impreso en 3D, Controlado por Smartphone Android
  10. PiBot: Robot Pianista con Arduino para Interpretación Musical de Precisión
  11. Pong Neón en Matriz NeoPixel con Arduino Nano