Product Introduction

1/17/2018 FireBeetle Covers-DC Motor & Stepper Driver SKU:DFR0508 - DFRobot Electronic Product Wiki and Tutorial: Arduino and Robot Wiki-DFRobot…
https://www.dfrobot.com/wiki/index.php/FireBeetle_Covers-DC_Motor_%26_Stepper_Driver_SKU:DFR0508#More 10/12
DFRobot_Stepper stepperA(SA): SA represents group A stepper motors (M1A (A+), M1B (A-), M2A (B+), M2B(B-))
2. Create a DC motor object.
DFRobot_Motor (M4): M4 represents group 4 DC motors (M4A (+), M4B (-))
3. Initiate the motor drive, read Product ID and Version ID, and print to the serial port.
init()
4. Set the rotation direction of the DC motor and start to rotate.
start(dir) dir=CW: rotate in C.W.(Clockwise) dir=CCW: rotate in anti-clockwise
5. Set angle, speed, direction of the stepper motor rotation and start to rotate.
6. The reverse function of group 4 DC motor.
reverse_4()
7. The reverse function of group A stepper motor.
reverse_SA()
Definition of API Function and Macro
Macro:
Object:
M1--->the first group DC motor--->[M1A(+),M1B(-)]
M2--->the second group DC motor--->[M2A(+),M1B(-)]
M3--->the third group DC motor--->[M3A(+),M3B(-)]
M4--->the fourth group DC motor--->[M4A(+),M4B(-)]
SA--->the group A stepper motor------>[M1A(A+),M1B(A-),M2A(B+),M2B(B-)]
SB--->the group A stepper motor ------>[M3A(A+),M3B(A-),M4A(B+),M4B(B-)]
Keyword Expansion:
CW: rotate in C.W.(Clockwise)
CCW: rotate in counter clockwise
CS (Chip Select) Address
A0: the first chip select address
A1: the second chip select address
A2: the third chip select address
A3: the fourth chip select address
Function:
The library used to control DC motor and stepper motor, including C.W rotation, C.C.W rotation, speed adjustment and stopping.
1. Open drive hardware of DC motor and stepper motor, read Product ID and Version ID.
void init();
2. Shutdown the drive hardware.void shutdown();
3. Stop the motor rotation.
void stop();
4. Set the DC motor rotation direction and start rotating.
void start(uint8_t dir);dir: set direction CW or CCW
5. Set angle, speed, direction of the stepper motor rotation and start rotating.
void start(float angle, uint16_t speed, uint8_t dir);angle: set the rotation resolution.
The maximum resolution is 0.9° which means the minimum rotate angle is 0.9°.
So that the motor won't rotate if the resolution set to be 0.1°and only rotate to 0.9° if the resolution set to be 1°.
Min: 0° (if the rotate angel set to be 0, the motor will keep rotating).
speed: set speed. The speed range is 0~1023. Set it to 0 and the rotate speed is 0r/min;set it to maximum 1023 and the rotate speed is 200r/min.
dir: set direction. dir=CW: rotate in C.W.(Clockwise) ; dir=CCW: rotate in CCW(anti-clockwise)
6. Speed control of DC motor & stepper motor
void speed(uint16_t val);val: set speed motor:0<=val<=4096 stepper:0<=val<=1023
Dimension Diagram
angle: set the rotation resolution. The maximum resolution is 0.9°, which means the minimum rotate angle is 0.9°.
So that the motor won’t rotate if the resolution set to be 0.1° and only rotate to 0.9° if the resolution set to be 1°.
Min: 0° (if the rotate angel set to be 0, the motor will keep rotating).
speed: set speed. The speed range is 0~1023. Set it to 0 and the rotate speed is 0r/min; set it to maximum 1023 and the rotate speed is 200r/min.
dir: set direction. dir=CW: rotate in C.W.(Clockwise) ; dir=CCW: rotate in anti-clockwise.