arduino is skipping the if statement Hi guys I am new to this language and i just tested the code to control a servo motor
Can anybody help me please ? here is the code

void setup() {

  servo_test.attach(3);      
  pinMode(9, INPUT);

}

void loop() {

 if ( digitalRead (9 == HIGH)) {

   for(angle = 0; angle &lt; 180; angle += 5)    to 180 degrees 
  {                                  
    servo_test.write(angle);                
    delay(5);                       
  } 

  delay(4000);
  for(angle = 180; angle&gt;=1; angle-=5)      to 0 degrees 
  {                                
    servo_test.write(angle);               specified angle
    delay(5);                       
  } 

    delay(4000);
}

}


It is just like the arduino completely ignore the if statement and start the loop wheter pin 9 is in high or low state  even if  i wire it directly to gnd
In your code this line:

 if ( digitalRead (9 == HIGH)) {


...is likely passing the function "digitalRead()" the value zero as "9 == HIGH" is likely false.

Likely what you want to do is check if the value returned by the function "digitalRead()" is high.  Try:

 if ( digitalRead (9) == HIGH) {


...instead.