Attiny85 PWM and integer question

Hello all!
First time poster, just got myself some Attiny85 and a programmer. Used PIC before but wanted to try out the Arduino IDE.

Anyway, my questions are:
Can i change the PWM frequency on the Attiny85?
If so, how? Any good places to read about this?
What is the default PWM freq for the attiny?
Also, i have a 5v vibration motor that i will use with the PWM, what are a good frequency for it?

last questions :stuck_out_tongue:
i got an input that returns 1-200, but i want an integer that is the reversed of that, so if it returns 200 i want my int to be 0, if it returns 50, my int should be 150.
Got any pointers? Tried with a for and a while loop, but that didn't work as intended :S

200-int= So 200-150=50, 200-50=150.

I will assume you are using this Core: Google Code Archive - Long-term storage for Google Code Project Hosting.

Changing the Timer0 or Timer1 prescaler will change the frequency. It's on pages 65-94 of the datasheet: http://www.atmel.com/images/atmel-2586-avr-8-bit-microcontroller-attiny25-attiny45-attiny85_datasheet.pdf

Note, the Core uses Timer1 for millis() and micros(), so you'll either want to use Timer0, or edit the Core config file and change it to Timer0 to free up the ( generally superior) Timer1 for your purposes.

As for frequencies for motors, it depends on what kind of driver you're using. Generally, faster is better, unless the frequent switching makes the transistors in your motor driver hot, in which case slower is better.

As for your last question, you can define a function

int invert200(const int input)
{
return 200-input;
}

and call it whenever you need something reversed

int myVar = 150;
myVar = invert200(myVar);
// myVar == 50 now