Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

I need some help porting code using PWM16.h to this library #2

Answered by khoih-prog
glennblock asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @glennblock

https://github.com/nicolaskruchten/arduino/blob/fc8b5804fc2da155384c528dfd2be0d629bba816/libraries/PWM16/PWM16.h#L96-L109

#define pwmN128Hz 127    // TOP values for various frequencies
#define pwmN64Hz  255
#define pwmN60Hz  272  // approx.; exact = 272.0667
#define pwmN50Hz  327  // approx.; exact = 326.68
#define pwmN32Hz  511
#define pwmN30Hz  545  // approx.; exact = 545.1333
#define pwmN16Hz  1023
#define pwmN8Hz   2047
#define pwmN4Hz   4095
#define pwmN2Hz   8191
#define pwmN1Hz   16383
#define pwmN1sec  16383
#define pwmN2sec  32767
#define pwmN4sec  65535

As you're using very low frequency, I suggest you start with the megaAVR_Slow_PWM library, designed specificall…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@glennblock
Comment options

@khoih-prog
Comment options

@khoih-prog
Comment options

Answer selected by glennblock
Comment options

You must be logged in to vote
1 reply
@khoih-prog
Comment options

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