Giter Site home page Giter Site logo

Channels about libpca9685 HOT 4 CLOSED

edlins avatar edlins commented on July 29, 2024
Channels

from libpca9685.

Comments (4)

edlins avatar edlins commented on July 29, 2024

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.

edlins avatar edlins commented on July 29, 2024

Also, have a look at PCA9685demo. That shows how to set individual channels while still using setAllPWM(). 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.
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.

pvint avatar pvint commented on July 29, 2024

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.

edlins avatar edlins commented on July 29, 2024

Closing for lack of activity. Please open a new issue if you still require assistance.

from libpca9685.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.