Coder Social home page Coder Social logo

khoih-prog / esp8266_pwm Goto Github PK

View Code? Open in Web Editor NEW
16.0 4.0 2.0 111 KB

This library enables you to use Interrupt from Hardware Timers on an ESP8266-based board to create and output PWM to pins. It now supports 16 ISR-based synchronized PWM channels, while consuming only 1 Hardware Timer. PWM interval can be very long (uint32_t millisecs). The most important feature is they're ISR-based PWM channels. Therefore, their executions are not blocked by bad-behaving functions or tasks. This important feature is absolutely necessary for mission-critical tasks. These hardware PWM channels, using interrupt, still work even if other functions are blocking. Moreover, they are much more precise (certainly depending on clock frequency accuracy) than other software timers using millis() or micros(). That's necessary if you need to measure some data requiring better accuracy

License: MIT License

C++ 46.07% C 53.42% Shell 0.51%
esp8266 pwm pwm-driver non-blocking duty-cycle precise pwm-frequency multi-channel-pwm isr-based-pmw pwm-duty-cycle

esp8266_pwm's Issues

calculate pwm resolution

Hi,
and thanks for the work you have done on this!
I have a small question as I am a little stuck here.
If I program a PWM frequency of say 100Hz, how would I be able to calculate the resolution of the pulse width?
cheers

Change Duty Cycle

when I use this lib, after setup the PWM paras, the PWM works well. But I need to change the duty cycle in working, for example, the breathing led.

I have tried to use disable or delete function, but it looks not work, the PWM duty cycle do not change.

So, it would be great if there is a duty cycle set up function.

DutyCycle to be updated at the end current PWM period

Original post from @ggmichael in Change Duty Cycle #1

Thanks for this! Your library has fixed a problem I was having with inconsistent calibration, which I now think arose from the changing timing of the analogWrite pwm.

One more feature that would be nice would be to be able to command a duty cycle update to occur at the end of the next full period instead of immediately (as I think happens now). If you're trying to create a continuously variable mean output voltage, resetting the channel at a frequency that approaches the PWM frequency causes a bias towards whichever part of the duty cycle comes first. This wouldn't happen if the update occurred at the end of the cycle. It may be that there are other applications (long cycles) where you would prefer the update straight away. So perhaps a flag to set either mode.

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.