CIRCUIT
OF MOTOR DRIVER BOARD USING L293D
void
straight();
void
back();
void
left();
void
right();
void
Stop();
void
setup() // put your setup code here, to run once:
{
//CONNECTED
TO L293D CONTROLLING THE LEFT MOTOR
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
//CONNECTED
TO L293D CONTROLLING THE RIGHT MOTOR
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
}
void
loop() // put your main code here, to run repeatedly:
{
straight();
delay(5000);
back();
delay(5000);
left();
delay(5000);
right();
delay(5000);
Stop();
delay(5000);
}
void
straight()
{
//LEFT
MOTOR FORWARD
digitalWrite(3,HIGH);
digitalWrite(4,LOW);
//RIGHT
MOTOR FORWARD
digitalWrite(9,HIGH);
digitalWrite(10,LOW);
}
void
back()
{
//LEFT
MOTOR BACKWARD
digitalWrite(3,LOW);
digitalWrite(4,HIGH);
//RIGHT
MOTOR BACKWARD
digitalWrite(9,LOW);
digitalWrite(10,HIGH);
}
void
left()
{
//LEFT
MOTOR STOPPED
digitalWrite(3,LOW);
digitalWrite(4,LOW);
//RIGHT
MOTOR FORWARD
digitalWrite(9,HIGH);
digitalWrite(10,LOW);
}
void
right()
{
//LEFT
MOTOR FORWARD
digitalWrite(3,HIGH);
digitalWrite(4,LOW);
//RIGHT
MOTOR STOPPED
digitalWrite(9,LOW);
digitalWrite(10,LOW);
}
void
Stop()
{
//LEFT
MOTOR STOPPED
digitalWrite(3,LOW);
digitalWrite(4,LOW);
//RIGHT
MOTOR STOPPED
digitalWrite(9,LOW);
digitalWrite(10,LOW);
}
I like it
ReplyDelete