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 < 180; angle += 5) to 180 degrees
{
servo_test.write(angle);
delay(5);
}
delay(4000);
for(angle = 180; angle>=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