In my project I want to control a fan and some LED's with PWM. I have 3 LED's on PWM 9,10,11 and they work (can set different brightness levels with analogWrite). I tried to do the same with Pin 6 for the fan. There it doesn't work. It seems as if it can only switch between full and nothing... Looks the same if i use digitalWrite instead of analogWrite.
I connected a LED to Pin 6 and it doesn't work too. If I measure the voltage, it's always on ~5V. If I measure it on 9/10/11 it very with my analogeWrite Value between 0 and 5V...
When I tried it with Pin 13 it was the same.
Could the PWM on Pin 6 and 13 be disabled? How did I do that? I tried to increase the frequency of the PWM so that the fan doesn't make noise. Maybe I had a wrong code there? Is it possible to factory reset all Timers on my Micro? Or how could I enable them again?
Any other ideas what could cause the problem?
Pin 13 can not produce PWM. Pin 6 can. You can not permenantly disable pin 6 so there is no factory reset possible.
You can disable the pin by using certain libaries that want to use the same timer.
In my program I'm only using IRemote.h library.
But I experimented a bit with the timers:
TCCR0B = TCCR0B & 0b11111000 | 0x03;
I'm not sure what I entered there exactly, but tried every timer from 1 to 4
Are this settings saved on the arduino somehow? So that if i remove it from the program, it still would be there?
Any other ideas which could cause the problem with pin 6 (and maybe 13)?
You should have said you has a micro at the start of your thread. The default Arduino is the Uno, unless otherwise said.
The micro has a 16U4-32u4 processor in it which has different timers to the normal Uno processor therefore a lot of libraries that use timers written for the Uno will not work or will do screwy things when you try and use them with the micro.
Therefore stuff for changing the PWM frequency written for a Uno is unlikely to work with a micro.