// ATmega 168P (Arduino) L298 и 74hc00 struct MOTOR { int in; // INVERTOR INPUT int enable; // ENABLE }; MOTOR MOTOR1 = { 7, 5 }; // D5-PWM, D7-Direction MOTOR MOTOR2 = { 8, 6 }; // D6-PWM, D8-Direction int FORWARD = HIGH; int BACK = LOW; void setup() { pinMode(MOTOR1.in, OUTPUT); pinMode(MOTOR2.in, OUTPUT); } void loop() { motor1(FORWARD, 50); motor2(FORWARD, 50); delay(3000); motor1(BACK, 100); motor2(BACK, 100); delay(5000); } void motor1(int dir, int pwm) { digitalWrite(MOTOR1.in, dir); analogWrite(MOTOR1.enable, pwm); } void motor2(int dir, int pwm) { digitalWrite(MOTOR2.in, dir); analogWrite(MOTOR2.enable, pwm); }