Modificacion para usar Puente H L298N en vez del integrado L293D

This commit is contained in:
Kevin Muñoz 2024-12-25 23:17:31 -05:00
parent 0c643db7fb
commit adfc9a2bff
Signed by: mrhacker
GPG Key ID: E5616555DD4EDAAE

View File

@ -1,27 +1,27 @@
#include <Arduino.h> //Permite utilizar los comandos de Arduino #include <Arduino.h>
#include "Motor_DC.h" #include "Motor_DC.h"
void Motor_DC::Inicializar_Motor() void Motor_DC::Inicializar_Motor()
{ {
pinMode(A, OUTPUT); pinMode(IN1, OUTPUT);
pinMode(B, OUTPUT); pinMode(IN2, OUTPUT);
pinMode(Pwm, OUTPUT); pinMode(ENA, OUTPUT);
} }
void Motor_DC::Atras(int Velocidad) void Motor_DC::Atras(int Velocidad)
{ {
analogWrite(Pwm,Velocidad ); analogWrite(ENA,Velocidad );
digitalWrite(A, HIGH); digitalWrite(IN1, HIGH);
digitalWrite(B, LOW); digitalWrite(IN2, LOW);
} }
void Motor_DC::Adelante(int Velocidad) void Motor_DC::Adelante(int Velocidad)
{ {
analogWrite(Pwm,Velocidad ); analogWrite(ENA,Velocidad );
digitalWrite(A, LOW); digitalWrite(IN1, LOW);
digitalWrite(B, HIGH); digitalWrite(IN2, HIGH);
} }
void Motor_DC::Stop() void Motor_DC::Stop()
{ {
analogWrite(0, Pwm); analogWrite(ENA, 0);
digitalWrite(A, LOW); digitalWrite(IN1, LOW);
digitalWrite(B, LOW); digitalWrite(IN2, LOW);
} }