Arduino Nano Every PWM Pin 9

Hello!

I am using an Arduino Nano Every for a project and I need to output a PWM specficially on Pin 9. I was able to get a lot of success using the Arduino Nano and the TimerOne library, but as such, the TimerOne library does not work with the ATmega4809. Is there anything similar to that TimerOne library for the ATmega4809, or will I have to get creative?

Thanks!

Welcome to the forum

Time to get creative I reckon. I foresee millis() or micros() in your near future

What do you want different from analogWrite(9, value)?

This claims to be a drop in replacement for the Timer1 library, using Timer B, on the Nano Every.
https://github.com/Kees-van-der-Oord/Arduino-Nano-Every-Timer-Controller-B

What is the frequency of the PWM signal?

Did you try
analogWrite(9, 127);
Pin9 is a common ~1kHz PWM pin according to this page.
Fiddling with the timers is only needed when you want a different PWM frequency or resolution,
which you forgot to mention.
Leo..

DPin-9 is 490 Hz.
PWMPins

The great Nano confusion.
OP has a Nano Every with an ATMega4809,
not the original Nano with the ATmega328, or the Nano 33 family with a SAMD21.
When you see "Nano" in a post, then you should always ask which one.
Default Nano Every PWM frequency on pin9 is 976Hz.
Leo..

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.