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
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
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