turn the motor on for a specific time

Hello everybody,

Our question is based on this great explanation:

https://learn.sparkfun.com/tutorials/sp … tor-basics

We want to achieve for our school project that the motor works for a specific time or rotates for a particular angle.

Can someone please help us in accomplishing this task?

With best regards

Sofie and Alex

If you’re using the Inventor’s Kit, use a delay() function and spinMotor(0) to stop the motors like in the example. Without a rotary encoder or other more sophisticated parts, your best bet would be measuring the revolution time of the motors and try to coordinate what you want in the code. 1 full rotation with 360 degrees at X amount of time, for 180 degrees you’ll just turn the motors for half of the time it took for a full rotation. It won’t be exact since the motors don’t stop instantaneously.