robot/robot_arduino/Robot_Seguidor/Motor_DC.cpp

28 lines
507 B
C++

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