void setup() {
  // put your setup code here, to run once:
pinMode(9, INPUT);
Serial.begin(9600);
pinMode(2, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  int h=digitalRead(9);
  if(h==1){
    digitalWrite(2,HIGH);
  Serial.println("Harakat bor");
  delay(200);
  }
  else{
     digitalWrite(2,LOW);
  Serial.println("Harakat yo'q");
  delay(200);
  }
}