Code Monkey home page Code Monkey logo

shiftregister-pwm-library's Introduction

ShiftRegister-PWM-Library

The ShiftRegister PWM Library enables usage of shift register pins as pulse width modulated (PWM) pins. Instead of setting them to either high or low, the library lets the user set them to up to 256 PWM-levels.

This post serves as a documentation page for the library.

shiftregister-pwm-library's People

Contributors

simsso avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

shiftregister-pwm-library's Issues

PWM

I am up to use this IC for a PWM. Do I have to use exact pins? Or I can use any of the digitals from UNO?

Improvement hints

Just a few quick thoughts:

  • Multi statement macros (e.g. ShiftRegisterPWM_toggleClockPinTwice) should be written using do{"statements"}while(0).
  • Consider calloc in the ShiftRegisterPWM to allocate and clear the memory at the same time, this avoids two nested loops.
  • Also floating point calculation (slow and long) code “value = (uint8_t) (value / 255.0 * resolution + .5)” can be avoided by something like “value = (uint8_t)( ( (uint_16)value * resolution + 127 ) / 255 )”.
  • I think one dimensional array (just to store channel values) is enough for this task as the actual output value is very easy to “compute” in the interrupt by comparing actual time variable to resolution variable. Sure it would be slower compared to the using the precomputed values at the large array.
  • A believe 74595 can be effectively fed by SPI.

Compatibility with ESP32

Hi @Simsso, this library is excellent and very easy to use. Very well documented on your blog too. May I ask if it is safe to use with the ESP32 dev module? Can it work theoretically with some modifications and adaptions, or it will damage something?

Thanks.

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.