robot/robot_arduino/Robot_Seguidor/Motor_DC.cpp

28 lines
507 B
C++
Raw Normal View History

#include <Arduino.h>
2024-12-25 21:57:57 -06:00
#include "Motor_DC.h"
void Motor_DC::Inicializar_Motor()
{
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(ENA, OUTPUT);
2024-12-25 21:57:57 -06:00
}
void Motor_DC::Atras(int Velocidad)
{
analogWrite(ENA,Velocidad );
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
2024-12-25 21:57:57 -06:00
}
void Motor_DC::Adelante(int Velocidad)
{
analogWrite(ENA,Velocidad );
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
2024-12-25 21:57:57 -06:00
}
void Motor_DC::Stop()
{
analogWrite(ENA, 0);
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
}