🐍 CircuitPython is the easiest way to program microcontrollers now celebrating over 200 boards!🐍
0

Speed control for Adafruit 16-Channel 12-bit PWM/Servo Drive
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Speed control for Adafruit 16-Channel 12-bit PWM/Servo Drive

by 30ppp on Wed Aug 10, 2016 8:17 am

Hi
Recently I bought "Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface - PCA9685" board for my Arduino Uno. (https://www.adafruit.com/products/815)
But I can't find ant way to control the servo speed.
The only method that I found is setPWM that there is no parameter as speed control for it.
any idea?

30ppp
 
Posts: 5
Joined: Wed Aug 10, 2016 8:02 am

Re: Speed control for Adafruit 16-Channel 12-bit PWM/Servo D

by adafruit_support_bill on Wed Aug 10, 2016 8:27 am

Seek speed is a function of the servo - not the controller. If you want to seek slower, you need to do an incremental seek.

adafruit_support_bill
 
Posts: 80841
Joined: Sat Feb 07, 2009 10:11 am

Re: Speed control for Adafruit 16-Channel 12-bit PWM/Servo D

by 30ppp on Wed Aug 10, 2016 8:31 am

Thanks for your replay.
Cant you please give me an example ?

30ppp
 
Posts: 5
Joined: Wed Aug 10, 2016 8:02 am

Re: Speed control for Adafruit 16-Channel 12-bit PWM/Servo D

by adafruit_support_bill on Wed Aug 10, 2016 10:39 am

The example included with the library does an incremental seek.
Code: Select all | TOGGLE FULL SIZE
  for (uint16_t pulselen = SERVOMIN; pulselen < SERVOMAX; pulselen++) {
    pwm.setPWM(servonum, 0, pulselen);
  }

If you want to change the speed, you can add a delay in the loop:
Code: Select all | TOGGLE FULL SIZE
  for (uint16_t pulselen = SERVOMIN; pulselen < SERVOMAX; pulselen++) {
    pwm.setPWM(servonum, 0, pulselen);
    delay(5);
  }

adafruit_support_bill
 
Posts: 80841
Joined: Sat Feb 07, 2009 10:11 am

Re: Speed control for Adafruit 16-Channel 12-bit PWM/Servo D

by 30ppp on Wed Aug 10, 2016 12:45 pm

There is problem with that.
If I have many servos and I want theme to run simultaneously and each of them have different pulselen upper code won't work at all and they will work sequential.

30ppp
 
Posts: 5
Joined: Wed Aug 10, 2016 8:02 am

Re: Speed control for Adafruit 16-Channel 12-bit PWM/Servo D

by adafruit_support_bill on Wed Aug 10, 2016 12:56 pm


adafruit_support_bill
 
Posts: 80841
Joined: Sat Feb 07, 2009 10:11 am

Re: Speed control for Adafruit 16-Channel 12-bit PWM/Servo D

by 30ppp on Sun Aug 21, 2016 3:16 pm

Thank you.
It worked properly !

30ppp
 
Posts: 5
Joined: Wed Aug 10, 2016 8:02 am

Please be positive and constructive with your questions and comments.