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"
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);
}