8835 Motor driver PWM Pin change

Dear Manager.
Hi, I’m using this motor drive
https://www.pololu.com/blog/394/two-new-motor-driver-shields-for-arduino
I have questions about using the product.
The PWM control pin of the motor drive is confirmed by 9 & 10. In your provided library (CPP & H file)
I want to change the Pin number Pin 9 -> Pin 6
because I use motor drive and LCD together.
However, the LCD also uses Pin 9. Therefore, they are nested.

I have tried several methods.
1.

  • const unsigned char DRV8835MotorShield :: _ M1PWM = 6; // 9 From the cpp file … and just save the file
  • Connect Pin 9 of Motor Driver to Pin 6 of Arduino
    == The motor did not move…
  • Arduino Pin9 and drive Pin 9
  • just change source code cpp, 9->6
    == The motor did not move…
  • cpp, Do not modify source code
  • change pin number, Arduino pin6 and drive pin 6
    == The motor did not move…

So,!!! I don’t know how to use Pin 6!!!

please help me…

thank you

Hello.

Our Arduino library for the DRV8835 Dual Motor Driver Shield configures Timer 1 to generate 20 kHz PWM frequency if you are using an Arduino based on the ATmega168, ATmega328P or ATmega32U4 (e.g. the Arduino Uno R3, Leonardo, Duemilanove). If you want to use pin 6, you will need to use analogWrite() to generate the PWM signals. Our library does this when DRV8835MOTORSHIELD_USE_20KHZ_PWM is not defined, so you should be able to get it to work that way by commenting out lines 4-6 in DRV8835MotorShield.h, which look like this:

#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined (__AVR_ATmega32U4__)
  #define DRV8835MOTORSHIELD_USE_20KHZ_PWM
#endif

Once you do that, changing the pin number associated with _M1PWM to 6 in DRV8835MotorShield.cpp like you mentioned should work.

Brandon