added motor speed and direction to prepare data function