Austin Detzel
Published © CC BY-NC-SA

How to Use a L293D Chip with Arduino and a Motor

Let's control an DC motor with a L293D chip and make it so it will go clockwise or counter clockwise.

BeginnerFull instructions provided30 minutes15,114
How to Use a L293D Chip with Arduino and a Motor

Things used in this project

Story

Read more

Code

Code snippet #1

Plain text
void setup() {

  }

void loop() {
  for(int i = 0; i<255; i++){
    analogWrite(5, i);
    analogWrite(6, 0);
    delay(5);
  }
  for(int i = 0; i<255; i++){
    analogWrite(5, 255-i);
    analogWrite(6, 0);
    delay(5);
  }
  for(int i = 0; i<255; i++){
    analogWrite(5, 0);
    analogWrite(6, i);
    delay(5);
  }
  for(int i = 0; i<255; i++){
    analogWrite(5, 0);
    analogWrite(6, 255-i);
    delay(5);
  }
}

Credits

Austin Detzel

Austin Detzel

26 projects • 38 followers

Comments