Skip to content

How to control an "Adafruit 16-Channel 12-bit PWM/Servo Driver"? #317

Answered by Rahix
joshuajbouw asked this question in Q&A
Discussion options

You must be logged in to vote

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:

  1. You're in luck and there already is an embedded-rust driver for this chip: 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.
  2. You can look at the Adafruit driver what it does (Adafruit_PWMServoDriver.cpp) and try replicating the same in Rust. It will most likely be very similar to the crate men…

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Rahix
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #211 on September 02, 2022 10:43.