Control IC H-Bridge L293 (without PWM control)
int L2 = 4;
int L1 = 5;
int R1 = 6;
int R2 = 7;
void setup()
{
pinMode(L1, OUTPUT);
pinMode(L2, OUTPUT);
pinMode(R1, OUTPUT);
pinMode(R2, OUTPUT);
}
void loop()
{
//TURNCW
digitalWrite(L1, HIGH); //cw right
digitalWrite(L2, LOW);
digitalWrite(R1, HIGH); //cw left
digitalWrite(R2, LOW);
delay(4000);
//TURNCCW
digitalWrite(L1, LOW); //ccw right
digitalWrite(L2, HIGH);
digitalWrite(R1, LOW); //ccw left
digitalWrite(R2, HIGH);
delay(4000);
//REVERSE
digitalWrite(L1, HIGH); //cw right
digitalWrite(L2, LOW);
digitalWrite(R1, LOW); //cww left
digitalWrite(R2, HIGH);
delay(4000);
//FOWARD
digitalWrite(L1, LOW); //cww right
digitalWrite(L2, HIGH);
digitalWrite(R1, HIGH); //cw left
digitalWrite(R2, LOW);
delay(4000);
}
Subscribe to:
Posts (Atom)