Using the Adafruit_Motor_Shield_V2_Library
To adjust the PWM frequency of the Motor Shield or Motor FeatherWing, refer to the Arduino code example for the Adafruit_Motor_Shield_V2_Library:
Using this library, the frequency can be changed from the default 1600Hz by including the new value in the begin
statement:
AFMS.begin(100); // Set the PWM frequency to 100Hz
Note that, at this time, the library does not provide a parameter for changing the default controller decay mode from FAST_DECAY to SLOW_DECAY.
Using the analogWrite()
Function
The PWM frequency of microcontroller GPIO pins using the analogWrite()
function is fixed and cannot be changed. PWM signals sent directly to a motor controller breakout from GPIO pins will default to a frequency of 490Hz to 1000Hz depending on the microcontroller board used. See Arduino Reference: analogWrite() for more information.
Text editor powered by tinymce.