This question is not same as the other one and this is more about employing the pwm signal to drive a CPU fan;
I am trying to follow the answer by Edgar Bonet on the question Need help to set PWM frequency to 25kHz and generate the same 25khz on pin 8 of arduino mega which is controlled by TIMER 4 and use this pwm signal to control the speed of a 4-wire cpu fan(with black, yellow, green and blue wires);
Following is my updated code for generating the pwm signal on timer 4
void analogWrite25k(int value)
{
OCR4C = value;
}
void setup()
{
TCCR4A = 0;
TCCR4B = 0;
TCNT4 = 0;
TCCR4A = _BV(COM4C1) // non-inverted PWM on ch. C
| _BV(WGM41); // mode 10: phase correct PWM, TOP = ICR4
TCCR4B = _BV(WGM43)
| _BV(CS40); // prescaler = 1
ICR4 = 320; // TOP = 320
// Set the PWM pin as output.
pinMode( 8, OUTPUT);
}
void loop()
{
analogWrite25k(10);
for (;;) ; // infinite loop
}
I have connected pin 8 on the mega to the pwm input on the fan(blue wire) but I dont see any variation in fan speed and fan seems to run at full speed;
I dont really have any means or tools to verify if its really generating a 25khz pwm signal but fan speed is not changing or if its not generating a 25khz pwm signal because of which there is no change in the speed of fan;
I am stuck at this point and any help on this would he highly appreciated;