Introduction: Mini L293D Módule and Arduino Nano or Uno -Stepper Motor

Português: Nesse tutorial irei mostrar como usar o módulo L293D com qualquer arduino, muito dificil achar alguma documentação de como usar, então decidi fazer esse tutorial, aproveitem:


Inglês: In this tutorial I will show how to use the L293D module with any arduino, it is very difficult to find some documentation on how to use it, so I decided to do this tutorial, enjoy:

Supplies

Step 1:

Português: Faça as ligações como na imagem acima


Inglês: Make the connections as in the image above

Step 2:

Português: Envie o código para o arduino:


Inglês: Send the code

Step 3:

#include <Stepper.h>


// Steps per Revolution, 360°/1.8° = 200 passos.

int SpR = 200;

float stepDegree = 1.8;


// Configuração Motor de Passo Pinagem - Enable A e B = 5V

#define IN1 8

#define IN2 9

#define IN3 10

#define IN4 11


// Instancia o motor de passo conforme SpR e pinagem do Arduino.

Stepper MotorPasso(SpR, IN1, IN2, IN3, IN4);


void Rotacionar(int angulo, uint8_t velocidade)

{

  MotorPasso.setSpeed(velocidade);

  int passos = angulo / stepDegree;

  Serial.println(passos);

  MotorPasso.step(passos);

     

  delay(600);

}


void setup()

{

  // Inicia a serial com 9600 de baudrate.

  Serial.begin(9600);

}


void loop()

{

  // Velocidade de 1 a 150

  Rotacionar(-180, 140);

  Rotacionar(180, 50);

  Rotacionar(-360, 100);

  Rotacionar(90, 10);

  Rotacionar(-90, 140);

}