I have been using an Arduino Nano as a PWM controller for a heating element.
I am currently using D11 (PB3). I could change, although all pins with PWM are in use, and would require a re-write and re-wire.
This produces a signal at ~490Hz, but I would like to experiment with changing this to a higher frequesncy.
I gather it its possible to vary the frequency by changing the divisor from its default 64.
My sketch uses Uses http://playground.arduino.cc/Main/SevenSegmentLibrary and calls millis() - will changing PWM divisor impact on either of these?
NOTE I have read the setPwmFrequency
documentation, but find "disrupts the normal operation" unhelpful - I am actually after some explanation of the concrete effect. I only use millis()
to time button presses and flash a LED, which are not time critical
Please keep in mind that changing the PWM frequency changes the Atmega's timers and disrupts the normal operation of many functions that rely on time (delay(), millis(), Servo library).
I have been doing some further study. http://playground.arduino.cc/Code/PwmFrequency states Changes on pins 3, 5, 6, or 11 may cause the delay() and millis() functions to stop working.
Other references say 3, 11 use timer 2
so do they affect millis()
or not as other references claim timer 0
is used for these.