int fanstart = 0; // start fan speed at 0
int fadeAmount = 20; // how many points to fade the LED by
void setup() {
// declare pin 3 to be an output:
pinMode(3, OUTPUT);
}
void loop() {
// set the speed of pin 3:
analogWrite(3, fanstart);
// change the speed for next time through the loop:
fanstart = fanstart + fadeAmount;
// reverse the direction of the fading at the ends of the fade:
if (fanstart == 0 || fanstart == 255) {
fadeAmount = -fadeAmount ;
}
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
nothing happens the fan runs on one speed !
Connections are the same
the connection ?? iam connecting Arduino Pin 3 (PWM) with TIP-122 Base (B) pin through 1k resistor.5V fan connect to the TIP-122 Collector (C). And the Emitter (E) pin connect to the Ground