     int obytes = strlen(buf);
     Serial.readBytes(&buf[obytes], available_bytes);
     buf[available_bytes + obytes] = '\0';
-    
     if(strlen(buf) > safesize){
       memmove(buf,&buf[strlen(buf) - safesize],safesize);
       buf[safesize] = '\0';

  rightMotor.Set(0); //(100 MAX FORWARD, -100 MAX BACK)
  
  Serial.begin(57600);
}

void loop() 
{
  readSerial();
  moveMotor();
}

void readSerial()

        sscanf(s, "[%d,%d]\n", &target_vel[0], &target_vel[1]);
        target_vel[0] = constrain(target_vel[0],-SPEED_LIMIT,SPEED_LIMIT);
        target_vel[1] = constrain(target_vel[1],-SPEED_LIMIT,SPEED_LIMIT);

      }
      memmove(buf, &e[1], strlen(&e[1]) + sizeof(char));
    }
    //softstop = millis();
  }
  //if(millis() - softstop > 5000){
    //Serial.print("SOFTSTOP");
    //target_vel[0] = 0;
    //target_vel[1] = 0;
  //}
}


void ramp(){
  if(millis() - lasttime > 50){
    if(leftVel< target_vel[0]){
      leftVel++;
    }
    if(leftVel> target_vel[0]){
      leftVel--;
    }
    if(rightVel< target_vel[1]){
      rightVel++;
    }
    if(rightVel> target_vel[1]){
      rightVel--;
    }
    lasttime = millis();
    Serial.print("TV0");
    Serial.print(target_vel[0]);
    Serial.print("TV1");
    Serial.print(target_vel[1]);
    Serial.print("LV");
    Serial.print(leftVel);
    Serial.print("RV");
    Serial.println(rightVel);
  }
}

void moveMotor()
{
  leftMotor.Set(-1*leftVel);
  rightMotor.Set(rightVel);

}

