Code for driving a BLDC motor and adjusting its speed using a pot. This photo shows wires to a slipring in the hollow shaft of a BLDC motor.
Project showcase by mbarraus
Additional code to rotate a BLDC and a stepper motor at the same time is now uploaded, above.
Thanks for your input Christian. It prompted me to revisit and improve my code. This is the beauty of open-source!
I appreciate that your suggestion will make the motor run smoother, however waiting until the interval elapses prevents me from achieving the other goal of this code, which is to drive a second motor at the same time. I haven't uploaded this additional code, but did get it working. Now I'm going to work on improving it with the edits I've uploaded above.
You were correct about printing slowing down the motor, so I've commented out Serial.print(, but left it in so that users can monitor the pot and phase the motor is in if they want.
Or connect with your social account:
New here? Create an account