Brushless motor control program with L293D.
Dependencies: brushlessController_L293D mbed
Diff: main.cpp
- Revision:
- 2:073c5513e2de
- Parent:
- 1:46f06c96c5f0
- Child:
- 5:c1f954e2f00a
--- a/main.cpp Mon Jul 13 14:13:55 2015 +0000 +++ b/main.cpp Thu Jul 16 15:18:06 2015 +0000 @@ -1,12 +1,40 @@ +/* Controlling a brushless motor with 2X L293D +* +* @author: Baser Kandehir +* @date: July 16, 2015 +* @license: Use this code however you'd like +* +* @description of the program: + +* Brushless motor control program with L293D. +* L293D is a simple, cheap standard DC motor driver and can be found easily. +* But I should say that controlling brushless motors with L293D is not efficient +* and precise. Proper way to control brushless motor is using an ESC or drivers +* like L6235. For the time being I have none of them, but I had a brushless motor that +* I wanted to control and see how it works. If you want to do the same, that program +* is for you. +* +* This guy did a great job by explaining how it is done: +* http://www.instructables.com/id/Arduino-CDROM-BLDC-Motor-Driver-Enhanced-Performan/ +* +* Note: For any mistakes or comments, please contact me. +*/ + #include "mbed.h" #include "brushlessController_L293D.h" +int prevStep = 0; + int main() { /* Example: After nine steps it will stop */ - brushlessControl(1, 500, 9); - + //brushlessControl(1, 500, 9); + while(1) - { + { + oneStep(0, 500, &prevStep); // One step forward wait 500ms + oneStep(1, 500, &prevStep); // One step backward wait 500ms + + /* 500 ms delay time is just for testing, you should reduce the delay time for better movement */ } }