How to use DC motor with Arduino Nano





int motor1_ena = 3;
int motor1_in1 = 4;
int motor1_in2 = 5;
void setup() {
  // put your setup code here, to run once:
   pinMode( motor1_ena , OUTPUT);
   pinMode( motor1_in1 , OUTPUT);
   pinMode( motor1_in2 , OUTPUT);

   digitalWrite( motor1_in1, HIGH);
   digitalWrite( motor1_in2, LOW );

    analogWrite( motor1_ena , 100);
}

void loop() {
  // put your main code here, to run repeatedly:

}

ความคิดเห็น