WebbotLib AVR library
WebbotLib It just does it
  C++ documentation  C documentation


Adds support for a generic bipolar stepper motor controller such as the L293D.
This uses 4 output pins to control the two coils as well as an optional output pin which is set high to enable the motor.
See _stepper_common.h for a description of the commands to control the motor.
If you are using an L293D then here is the schematic:-
The enable pins are pulled high using a 10k resistor just in case you choose not to use the enable logic. If you wish to be able to disconnect the motor (ie turn off the supplied current) then specify an enable output pin from your board and connect it to pins 1 and 9.




BIPOLAR MAKE_BIPOLAR(inverted,steps, accel, every, coil1A,coil1B, coil2A,coil2B, enable, mode)

Create a bipolar stepper motor controller.
The parameters are as follows:
Let's assume that we have a stepper motor with 200 steps per revolution and that we choose to use half stepping mode to achieve 400 steps per revolution. Also assume we configure the driver to produce a maximum of 300 pulses per second. This means that the maximum speed of the motor will be 0.75 revolutions per second (ie 45 rpm).
If we used 'accel = 10' and 'every = 2' then this means the motor speed will increase by 10 units every 150th of a second (300 pulses per second divided by 2) until it reaches the requested speed. Note that values of 'accel = DRIVE_SPEED_MAX' and 'every = 1' will effectively give infinite acceleration.
We will use pins A0 to A3 for the coils and leave the enable unused.
BIPOLAR motor = MAKE_BIPOLAR( FALSE, 200, 10, 2, A0, A1, A2, A3, null, HALF_STEP);

Valid XHTML 1.0 Transitional