Go Down

Topic: PWM frequency library (Read 335456 times) previous topic - next topic


This Library didn't work. The following message was appeared:
The library "Arduino PWM Frequency Library v_05" cannot be used.
Library names must contain only basic letters and numbers.
(ASCII only and no spaces, and it cannot start with a number)

Please, I need it!


Hi, could anyone help me?
I have noticed that there's no PWM.cpp file. The library wasn't installed.


You extracted the filename of the zip file directly into your library directory as "Arduino PWM Frequency Library v_05"
You should simply make a directory under libraries and call it PWM for example.
C:\Program Files\arduino-1.8.1\libraries\PWM

Then copy all the stuff in under the PWM directory into this new library PWM directory, and copy PWM_lib_example and PWM_lib_resolution_example into there as well.

It should look like this when your done ...

 Directory of C:\Program Files\arduino-1.8.1\libraries\PWM

11-May-2018  16:49    <DIR>          .
11-May-2018  16:49    <DIR>          ..
16-Aug-2012  16:55             2,208 keywords.txt
24-Sep-2012  15:24             4,873 PWM.h
11-May-2018  14:38    <DIR>          PWM_lib_example
11-May-2018  14:38    <DIR>          PWM_lib_resolution_example
11-May-2018  16:49                 0 showDir.txt
11-May-2018  14:38    <DIR>          utility
               3 File(s)          7,081 bytes
               5 Dir(s)  113,831,374,848 bytes free


I like to using this pwm.h librari variable phase shifting arduino between two pwm chanel.
I like the shifing variable 0-180 degrees.

Somebody doing same?



Cannot compile the code for Atmega8. While I tried compiling for Atmega168, the code uses 2720 bytes of space and compiles successfully and works fine. Anyone please help me.


post your code if you want help



I am trying to lower the Arduino Uno PWM frequencies to drive 4 x solenoid valves. Ideally, pins 5 & 6 are untouched to retain timer0 function. However, understand that creating custom frequencies would sacrifice 2 pins on Arduino, which I have found out to be pins 6 and 11. 

In the original post by runnerup:
"If you don't want to sacrifice any 8bit PWM pins, don't call the initialize function for that timer, try changing the prescaler to manipulate frequency instead. "

So if I would like to leave pins 5 and 6 untouched and change PWM frequency for pins 3, 9, 10 AND 11 to 31Hz? Do I simply use this setup to change the timer prescaler and the PWM frequencies for the 4 pins would be lowered to 31Hz?

Code: [Select]
void setup()

I tried doing that and alternatively using this function PwmFrequency to also change the prescaler. But neither works.

So is this a limitation such pins 6 and 11 cannot be used?

Appreciate some clarification/ advice, thanks!


Great Library

Some problems i am facing:
1- Cannot modify the frequency of pin 11, the bool doesn't return success
2- Can't get the resolution on pin 3 and 11 although the timer gives me resolution

Go Up