
TCCR2B = TCCR2B & B11111000 | B00000111 // for PWM frequency of 30.64 HzĬode for Available PWM frequency on D5 & D6:
#Arduino nano pinout gpio code
So to achieve frequency lower or higher than the default frequency on PWM pins, the one-line command that we can use before initializing the PWM pin as output is given below: Commands for changing Arduino Nano PWM pins frequency Code for Available PWM frequency on D3 & D11: But these default frequencies are not suitable for High-frequency circuits like buck/boost converters and S.M.P.S. Now, these frequencies are optimum for low-frequency applications like fading an LED. Default PWM frequency from D3, D9, D10, and D11: 490.20 Hz (The DEFAULT) Default PWM frequency for D5 & D6: 976.56 Hz (The DEFAULT) The default PWM frequency for all pins is 490 Hz, except pins 4 and 13 whose default frequency is 980Hz.

These pins are numbered as 3, 5,6,9,10, and 11. On Arduino Nano, there are a total of 6 PWM pins available.
#Arduino nano pinout gpio how to
How To Change Frequency On PWM Pins Of Arduino UNO Looking for Arduino UNO PWM frequency change? This is done by adding a one-line command in the code section without altering the shape of the PWM wave or major attenuation. But there is a certain default frequency with which PWM output is generated out of the PWM pins of Arduino Nano.Īnd this default frequency can be changed to a value as high as 65Khz for some pins and as low as 30Hz for other pins.


Depending on your application/project this frequency may vary. Any PWM value between 0 and 255 gives the voltage between 0 and 5 volts at the output.Īs mentioned above, the PWM output is achieved by switching the input voltage(5V) at a certain frequency. PWM value 255 means 5 Volts at the output and 0 means 0 volts. To get the PWM output, the “ analogWrite(PWM pin, PWM value)” command is used.
