
This is my circuit. When 12V switched on the fan is suddenly spinning slowly and after any command from arduino it reaches its maximum speed as it should be.
But i want this fan not spinning initially until my command. What should i do?
Code:
int led = 9;
String x;
int val;
void setup(){
Serial.begin(9600);
pinMode(led, OUTPUT);
}
void loop(){
if(Serial.available()>0)
{
x=Serial.readStringUntil(',');
val=x.toInt();
analogWrite(led, val);
}
}