Oct 1, 2019

Pololu single motor driver - DRV8838 - Arduino code (모터 드라이버)



- Simple Arduino code to operate a DC motor with the motor driver.
- 1개의 DC 모터를 구동시키기 위해 모터 드라이버를 이용하는 간단한 아두이노 코드.
int Enable_pin = 9;
int Phase_pin = 8;

void setup() {
  // put your setup code here, to run once:
  pinMode(Enable_pin, OUTPUT);
  pinMode(Phase_pin, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  // 0<speed<255
  motor_move(250);
}

void motor_move(int _speed){
  analogWrite(Enable_pin, _speed);
  digitalWrite(Phase_pin, LOW);
  //or digitalWrite(Phase_pin, HIGH);
}

No comments:

Post a Comment