Comments (4)
Hello!
The following function documentation was accidentally left out of the README:
// set a single PWM channel with a 16-bit ON val and a 16-bit OFF val
int PCA9685_setPWMVal(int fd, unsigned char addr, unsigned char reg,
unsigned int on, unsigned int off);
Remember though, as with the other functions, only the low 12 bits of the 16-bit ON and OFF values are used on the PCA9685. Also keep in mind that this function does not use a combined transaction so it should be slower on a per-channel basis than the speedy PCA9685_setPWMVals()
.
Please let me know if this works for you or if your requirements are different.
from libpca9685.
Also, have a look at PCA9685demo
. That shows how to set individual channels while still using . You just keep track of all 16 of your values in an array and only change the values for the channels you want to adjust.setAllPWM()
Edit: Must not have finished my coffee.. From the quickstart example:
unsigned int setOnVals[_PCA9685_CHANS] =
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
unsigned int setOffVals[_PCA9685_CHANS] =
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
// blink endlessly
while (1) {
// setup random values array (seizure mode)
int i;
for (i=0; i<_PCA9685_CHANS; i++) {
int random = rand();
int value = (float) random / (float) RAND_MAX * _PCA9685_MAXVAL;
setOffVals[i] = value;
}
// set the on and off vals on the PCA9685
PCA9685_setPWMVals(fd, addr, setOnVals, setOffVals);
}
from libpca9685.
If you check here you will see an example that worked:
pvint/fade9685@8957814#diff-e1029dd5a7350ee44c988fd619e3baa4
(Note that this was just an early "proof of concept" and has since changed, but it worked)
from libpca9685.
Closing for lack of activity. Please open a new issue if you still require assistance.
from libpca9685.
Related Issues (20)
- multiple buses/devices HOT 9
- stderr
- fix handling of fd and addr
- remove non-debug stdout output
- use one set of VERSION vars throughout HOT 1
- types changes
- examples adpt/addr HOT 1
- demo set frequency
- examples/audio HOT 5
- olaclient tests HOT 2
- Exclude examples from default make HOT 7
- Readme.md update - required modules on Pi Zero W HOT 3
- provide netinst.sh for netinst HOT 7
- examples shutdowns
- #include <stdbool.h> in PCA9685.h
- doc PCA9685_setPWMVal()
- olaclient can't create log as olad in Travis, running as root HOT 1
- Docs
- LEDs never fully turn off HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libpca9685.