Code 2 motor DC:
int IN1 = 2;
int IN2 = 3;
int IN3 = 4;
int IN4 = 5;void setup() {
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
}void loop() {
ControlCar(1, 0, 1, 0);
delay(2000);
ControlCar(0, 1, 0, 1);
delay(2000);
}void ControlCar(int a,int b,int c,int d) {
digitalWrite(IN1, a);
digitalWrite(IN2, b);
digitalWrite(IN3, c);
digitalWrite(IN4, d);
}