generate 1 Hz to 40 Hz signal

I am using ATMEGA32U4 (Arduino board ). I am facing problem with TIMER. I want to generate 1 Hz to 40 Hz signal in two pins and change PWM signal with certain period of time.

Example:

TIME | PIN9 Freq. | PIN9 PWM | PIN10 Freq. | PIN10 PWM | Alternate Mode
T0 | 2Hz | 50% | 2Hz | 50% | 0
T1 | 3Hz | 50% | 15Hz | 20% | 0
T2 | 30.5Hz | 40% | 2.5Hz | 50% | 0
T3 | 2Hz | 50% | 2Hz | 50% | 1
Alternate Mode activate gives 180 degree phase shift b/w PIN9 and PIN10.

You could do that frequency range in software.

Deepak88Aagri:
I am using ATMEGA32U4 (Arduino board ). I am facing problem with TIMER. I want to generate 1 Hz to 40 Hz signal in two pins and change PWM signal with certain period of time.

There are no "Arduino comfort functions" to program the Atmega hardware timers directly.

You would need to learn about Atmega timer programming based on low-level register programming to program the timer registers of the Atmega controller directly.

Perhaps you can find a "library" from a third-party which can help you doing what you want.

But for slow frequencies like 10 or 40 Hz it is possibly simpler to establish a programming logic using Arduino comfort functions like "micros()" and "digitalWrite()" instead of direct timer programming.

Gotta say it! :roll_eyes:

Why do you not explain what you actually need to do?

In other words, what is this for, how accurate do you need these signals, in what combinations?

So far you have not explained anything useful, I am afraid.