How to compare two numbers and let one motor turn

I mean compare the two sensors' input and control motor to run till the two numbers are equal.

I guess there may be many post on this. any clue?

Thanks
Adam

laoadam:
any clue?

How to use this forum.

How does running the motor affect the sensors?

jremington:
How does running the motor affect the sensors?

Thanks.
The sensor value changes as motor moving.
Best.

laoadam:
I mean compare the two sensors' input and control motor to run till the two numbers are equal.

Don't you think it would be useful to tell us what the sensors are (post a link to their datasheet) and generally provide a description of the project you are trying to implement?

...R

The sensor value changes as motor moving.

Then, just run the motor in the direction that makes the difference zero.

jremington:
Then, just run the motor in the direction that makes the difference zero.

...Which can be done with if and else.

However I suspect there's more to it than that, details are always vital, give us the details.

I mean compare the two sensors' input and control motor to run till the two numbers are equal.

if (sensor1 == sensor2) {
  stopMotor;
} else {
  runMotor;
}

Thanks for all help.
Sorry I didn't provide sufficient information, because I don't have yet myself, I'm planing a new project now, trying to get a lucky reference or clue.
Best.

laoadam:
I'm planing a new project now

Why not tell us what the project is?

...R