Temperature Fan Control PWM Arduino Help!

digitalWrite() turns the pin HIGH or LOW, one time. analogWrite() starts the pin toggling on and off, so that it's on amount is the ratio specified.

Ditch the complicated code. Write a sketch that calls analogWrite() with various values, from 0 to 200, with a 2 second delay between changes. If the fan speed does not change, the fan is not meant to be variable speed.