Preventing Burned Out Motors
I did not think that this post belongs in the Beginners Tips section, so I put it here.
Since many people have burned out motors by putting too much torque on them, and the motors are expensive, I wrote a code that acts like a circuit breaker when too much torque is applied. It will temporarily stop the motor until the user presses a button to release it. All you need is an encoder. I have only written it for one motor, and because every robot is different, you will have to add more code to make it work for multiple motors. You can change the amount of torque that is needed before the motors stops by changing the value of the variable "threshold". Here is the code:
That's it. If you implement this, let me know how it goes.