i have a not to fancy code but i have problems to compile it.
I need a high PWM frequency and i just heard the problem is the processor of the Arduino Nano Every that the librarys are not suitable right?
Is there a solution to it? i didnt find anything yet.
Thats the compilation error:
Compilation error: 'analogWriteFrequency' was not declared in this scope
There is a very good book from Tom Almy called "Far Inside The Arduino: Nano Every Supplement" He covers comprehensibly all the things you can do with it.
Be aware that "PWM" is not what a lot of people think it is. PWM is a fixed frequency and the duty cycle is varied. Usually the PWM frequency is not varied. Certain devices can handle set PWM frequencies, for example a servo might handle 50Hz PWM, or some actuators might handle up to 500Hz it depends what they are designed for. Typically an Arduino does 490Hz PWM.
analogWrite sets the duty cycle of a PWM-capable pin.
In Arduino terms Tone is more like what people expect, where the frequency is varied with a 50% duty cycle - so a classic square wave.
Depending on your Arduino model Tone can do from 31Hz to quite some high frequency, higher than you need.
Look up Tone in the Arduino reference, and here's some extra info:
The MegaCoreX is always advantageous, no longer occupies TCA for millis. TCA is thus freely usable.
A simple example which can be further refined into separate frequency and duty setting. For the prescaler you can choose 1 or 2 or set it to from TCA. Then you have all prescalers of TCA available.
Hi, I am doing a project that need that, can you tell me how to use this repo to include the AnalogWriteFrequency function on my project code? as I am totally beginner ? thanks a lot