   static int timer_count = 0;
 
   timer_count++;
-  if(timer_count % 4 == 0) {
-    //0.02 second reached
-    ButtonBuf = ButtonBuf * 2 + digitalRead(BUTTON);
-    SlotBuf = SlotBuf *2 + digitalRead(SLOT); 
-    } 
   if(timer_count ==200) {
     //0.1 secound reached
     time200 = 1;

    timer200 = 0;
    }
  //Check serial port
  
  //apply the command on motor

}
  

 
 pinMode(BUTTON, INPUT);
 pinMode(SLOT, INPUT);

 //set other output 
}

void sendData(){
  //send IR distance to computer
  Serial.write("I");
  Serial.write(irValue);
  Serial.print("\n"); 
  //send Sonor distance to computer
  Serial.write("X");
  Serial.write(sonicValue);
  Serial.print("\n"); 
  //send encoder Value
  Serial.write("W");
  Serial.write(encoderValue);
  Serial.print("\n");
  //send button state
  Serial.write("B");
  Serial.write(buttonValue);
  Serial.print("\n"); 
  //send slotswitch state
  Serial.write("S");
  Serial.write(slotValue);
  Serial.print("\n"); 
}

void readSensor(){
  //receive IR distence
  irValue= getIRDistance_mm();
  //receive ultrasonic distance 
  sonicValue = getSonicDistance_mm();
  //receive encoder data
  encoderValue = getDCSpeed_rpm();
  //read button state
  buttonValue = isPushedButton();
  //read slotswitch state
  slotValue = isTriggeredSlot();
}


