what is the problem in this motor control arduino code

can you please help in writing a sample code

Sure. What should it do?

It isn't rocket science to set dataFromBT to 0 after you've used the value that you read.

It isn't rocket science to post your code properly.

It isn't rocket science to figure out that one period is enough.