If memory serves, the clock speed of an arduino Uno is 16Mhz. Some are faster, some much faster and a few are slower.
Most assembler instructions take around 1-3 clock cycles. A few take more. Assuming an average of 3 ticks per instruction, that translates to executing over 5 million instructions per second.
So, unless your motor is approaching supersonic speeds, the arduino should be able to "keep up" with polling your motor's sensor in your loop()
function.
If you are doing a few other things in your loop, you might consider using an interrupt to trigger some code when the motor "activates" the sensor. In this case you will unlikely need to worry about the speed of the CPU at all. When using an interrupt, you do not need to worry about polling the state of your sensor inside the loop()
function.
Always remember to keep the code in your interrupt service routine as short and fast as possible. In this case, probably you would just turn off the motor and return when the interrupt is triggered.
Having said all of that, you will still need to do some work to get the most appropriate implementation as only you know what other things you need to take into account at this time.
One other thing to note is that a single high level instruction will normally equate to more than one assembler instruction. Even a simple statement like int x = 1000;
will be more than one assembler instruction and thus take more than 1 clock tick. However, if memory serves, the individual instructions generate to execute x = 1000
will all take just one clock tick.
Others will vary the amount of instructions that are generated to execute them. For example
float x = 1.0;
x = x + 2.0;
will likely take more instructions to execute than it's integer counterpart:
int x = 1;
x = x + 2
I hope this helps and enables you to try controlling your motor via Arduino. If not, you can always ask a more specific question later.