Hello, I want to use a frequency of 300Hz on pins 3,5,6,7 in arduino mega 2560 for running the ESC of my brushless motors. According to post: Arduino Forum I changed the code in void setup() to:
int myEraser = 7; // this is 111 in binary and is used as an eraser
TCCR3B &= ~myEraser; // this operation (AND plus NOT), set the three bits in TCCR3B to 0
TCCR4B &= ~myEraser;
int myPrescaler = 4; // this could be a number in [1 , 6]. In this case, 4 corresponds in binary to 100.
TCCR3B |= myPrescaler; //this operation (OR), replaces the last three bits in TCCR3B with our new value 100.
TCCR4B |= myPrescaler;
- The prescaler 4 is used for 120Hz as in the post, what should I use to get 300Hz?
2.The ESC's and motors do not work on any other prescaler rather than 3, why?
3.The pwm frequency of my ESC is 2KHz, it works fine on 500Hz.