From adfc9a2bff012e91d2e57e721bb0d642848baa35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20Mu=C3=B1oz?= Date: Wed, 25 Dec 2024 23:17:31 -0500 Subject: [PATCH] Modificacion para usar Puente H L298N en vez del integrado L293D --- robot_arduino/Robot_Seguidor/Motor_DC.cpp | 28 +++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/robot_arduino/Robot_Seguidor/Motor_DC.cpp b/robot_arduino/Robot_Seguidor/Motor_DC.cpp index d8aa0ce..4b38efa 100644 --- a/robot_arduino/Robot_Seguidor/Motor_DC.cpp +++ b/robot_arduino/Robot_Seguidor/Motor_DC.cpp @@ -1,27 +1,27 @@ -#include //Permite utilizar los comandos de Arduino +#include #include "Motor_DC.h" void Motor_DC::Inicializar_Motor() { - pinMode(A, OUTPUT); - pinMode(B, OUTPUT); - pinMode(Pwm, OUTPUT); + pinMode(IN1, OUTPUT); + pinMode(IN2, OUTPUT); + pinMode(ENA, OUTPUT); } void Motor_DC::Atras(int Velocidad) { - analogWrite(Pwm,Velocidad ); - digitalWrite(A, HIGH); - digitalWrite(B, LOW); + analogWrite(ENA,Velocidad ); + digitalWrite(IN1, HIGH); + digitalWrite(IN2, LOW); } void Motor_DC::Adelante(int Velocidad) { - analogWrite(Pwm,Velocidad ); - digitalWrite(A, LOW); - digitalWrite(B, HIGH); + analogWrite(ENA,Velocidad ); + digitalWrite(IN1, LOW); + digitalWrite(IN2, HIGH); } void Motor_DC::Stop() { - analogWrite(0, Pwm); - digitalWrite(A, LOW); - digitalWrite(B, LOW); -} + analogWrite(ENA, 0); + digitalWrite(IN1, LOW); + digitalWrite(IN2, LOW); +}