Can someone explain to me how could I program in IDE to set ATTiny85 so it's PWM would be operating at fixed frequency (say 200Hz, something high enough that LED flicker won't be noticed but not so high MOSFET has trouble switching) while having variable duty cycle? I want to be able to adjust the LED brightness.
What is the default PWM frequency for ATTiny85 anyway?
As you probably know, the PWM is controlled by one of the timers on the microcontroller chip. To change the frequency of the PWM output, you will have to modify the values of some of the internal registers of the ATtiny85 you are using. I'm 99% certain you can do this directly in your IDE code, (not 100% because I have never done it before).
The default pwm frequecy of the t85 (at lrast using my core see links in sig) is same as uno, few hundred hz (dont know it off hand). This is a value chosen by the same criteria as you specified. So you may not need to change the frequency! Note that two of the pwm pins are controlled by timer 0, which you cant change the frequency of without breaking millis and delay.
Changing the frequency of the one on timer1 is trivial to do by powers of 2 by just changing the prescaler register (timer1 on the t85 is weird - unlike timer1 on almost every ither avr, its 8 bits, but can be clocked off the pll if you desire (theres even a menu option for this in my core - very few avrs have the pll, i know of only the t85 and t861) giving it a base clock speed of 32 or 64MHz, and has every power of 2 up to iirc 16K available on the prescaler.) If you just change the prescaler, analogWrite still works without special considerations. For more precise control of frequency, you also have to change ehat it counts up to (TOP in datasheet terminology) and so you need to account for that when you set dutycycle with analogWrite.