How to control an "Adafruit 16-Channel 12-bit PWM/Servo Driver"? #317
-
Hey there, this is a general question. I also understand that this is a fairly low-level library which I am completely fine with. However, I am struggling to find good information on exactly what the data packet should be to be able to control a servo on board 0x40. If you can point me in the right direction, I'll be more than grateful. |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
You need to provide more information, I cannot help you from this. What do you mean by "Using i2c to PWM 16 servo x 12bit board"? Do you have an I2C PWM port-expander which you're using to control a servo? Please provide a description of the circuit (even better: schematic), and exact part numbers for the components involved. Otherwise there is no way I can know what you need... |
Beta Was this translation helpful? Give feedback.
-
Sure. Hardware
Connections
I had followed the Printout of the example, if needed:
|
Beta Was this translation helpful? Give feedback.
-
Thanks. It looks like that board of yours uses a PCA9685 "16-channel, 12-bit PWM Fm+ I2C-bus LED controller" (datasheet). You'll need to correctly write to its registers to archieve your desired goal. There are three routes you can take here:
|
Beta Was this translation helpful? Give feedback.
-
Works flawlessly. Thank you. |
Beta Was this translation helpful? Give feedback.
-
That's great to hear! Would you mind sharing some sample code here, for future readers, to demonstrate how you got it working? Even better, maybe submit an example as a PR, e.g. as |
Beta Was this translation helpful? Give feedback.
-
Sure, can do so once I am through work for the day. |
Beta Was this translation helpful? Give feedback.
Thanks. It looks like that board of yours uses a PCA9685 "16-channel, 12-bit PWM Fm+ I2C-bus LED controller" (datasheet). You'll need to correctly write to its registers to archieve your desired goal. There are three routes you can take here:
pwm-pca9685
. You might be able to just hook that up to the i2c driver from avr-hal and then use its API to control the generated PWM signal. Here is an example I found, which might help:pca9685-servos-f3.rs
.Adafruit_PWMServoDriver.cpp
) and try replicating the same in Rust. It will most likely be very similar to the crate men…