PWM HELP

Hello fellow programers.

I have been reading a lot of treads and trying out a couple of different libraries, yet i don't seem to get the resut that I am searching for.

So, i need to generate 2 different pwm at different contralable frequancies on the same board. I am using an Arduino Mega.

Can any one help, or guide me to the correct post?

What libraries? In what way were they insufficient?

hi, i have tried to use:

https://forum.arduino.cc/index.php?topic=448414.0

And it works, but only when I use Timer 1. When i try to implement a second pwm usind a diffrent timer it just dosen't generate the second pwm.

I am aware that every timer as assigned pins, so that is not my problem.

I was able to generate a perfect pwm with the wanted frequency, duty cicle... but only one. I wish to generate 2 ditinct ones.

So, you took a library from a different thread that was reporting an issue about not working correctly beyond Timer1 and you expect it to work? That thread you reference was basically a bug report from several years ago and there was no mention of it being fixed. The git repo is also 3 years old so I am guessing the bug remains.

juliovbg:
And it works, but only when I use Timer 1. When i try to implement a second pwm usind a diffrent timer it just dosen't generate the second pwm.

I am aware that every timer as assigned pins, so that is not my problem.

I was able to generate a perfect pwm with the wanted frequency, duty cicle... but only one. I wish to generate 2 ditinct ones.

Okay, you have code. Can we see it?

blh64:
So, you took a library from a different thread that was reporting an issue about not working correctly beyond Timer1 and you expect it to work? That thread you reference was basically a bug report from several years ago and there was no mention of it being fixed. The git repo is also 3 years old so I am guessing the bug remains.

Yes. Noob move. You are right. I guess I will have to go back to timers and do it on my one. I was just looking for a fast solution for my problem since it is just a part of a bigger experiment.

aarg:
Okay, you have code. Can we see it?

Thanks for the support, if I have any problems I will come back to the Forum.

Have you looked at Nick Gammon's page about timers? It's very in depth, and has many examples.

aarg:
Have you looked at Nick Gammon's page about timers? It's very in depth, and has many examples.

Thanks, I will look into that.