 
 void receiveData(int byteCount)
 {
+    //Serial.print("Avail: "); 
+    //Serial.println(Wire.available());
+  
     while(Wire.available())
     {
-      if(Wire.available()==5)
+      if(Wire.available()==6)
       {
         flag=0; 
         idx=0;

{
  byte servo = cmd[1];
  byte side = cmd[2];
  byte speed = cmd[3];

  Serial.print("Dynamixel Set Endless");
  Serial.print(", servo: "); Serial.print(servo);
  Serial.print(", side: "); Serial.print(side);
  Serial.print(", speed: "); Serial.println(speed);

void loop()
{
  long dur,RangeCm;
  if(idx==6)
  {
    flag=1;
    //IR reciever pin set command
