upm  1.3.0
Sensor/Actuator repository for libmraa (v1.7.0)
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions | Protected Attributes
ULN200XA Class Reference

UPM module for the ULN200XA Darlington Stepper Driver. More...

Detailed Description

This module was developed on a ULN2003A Stepper Driver. It should also support the ULN2001A, ULN2002A, and ULN2004A devices, when using to drive the 28BYJ-48 unipolar stepper motor.

Vcc goes to the 5V pin on your development board and the Vm pin should be connected to an external 5V supply.

uln200xa.jpg

Example driving a stepper motor

// Instantiate a Stepper motor on a ULN200XA Darlington controller.
// This was tested with the Grove Gear Stepper Motor with Driver
// Wire the pins so that I1 is pin D8, I2 is pin D9, I3 is pin D10 and
// I4 is pin D11
upm::ULN200XA* uln200xa = new upm::ULN200XA(4096, 8, 9, 10, 11);
uln200xa->setSpeed(5);
uln200xa->setDirection(ULN200XA_DIR_CW);
cout << "Rotating 1 revolution clockwise." << endl;
uln200xa->stepperSteps(4096);
cout << "Sleeping for 2 seconds..." << endl;
sleep(2);
cout << "Rotating 1/2 revolution counter clockwise." << endl;
uln200xa->setDirection(ULN200XA_DIR_CCW);
uln200xa->stepperSteps(2048);
// turn off the power
uln200xa->release();

Public Member Functions

 ULN200XA (int stepsPerRev, unsigned int i1, unsigned int i2, unsigned int i3, unsigned int i4)
 
 ~ULN200XA ()
 
void setSpeed (unsigned int speed)
 
void setDirection (ULN200XA_DIRECTION_T dir)
 
void stepperSteps (unsigned int steps)
 
void release ()
 

Protected Attributes

uln200xa_context m_uln200xa
 

Constructor & Destructor Documentation

ULN200XA ( int  stepsPerRev,
unsigned int  i1,
unsigned int  i2,
unsigned int  i3,
unsigned int  i4 
)

ULN200XA constructor

Parameters
stepsPerRevNumber of steps per full revolution
i1Digital pin to use for stepper input 1
i2Digital pin to use for stepper input 2
i3Digital pin to use for stepper input 3
i4Digital pin to use for stepper input 4
~ULN200XA ( )

ULN200XA destructor

Here is the call graph for this function:

Member Function Documentation

void setSpeed ( unsigned int  speed)

Sets the speed of the stepper motor in revolutions per minute (RPM)

Parameters
speedSpeed to set the motor to, in RPM

Here is the call graph for this function:

void setDirection ( ULN200XA_DIRECTION_T  dir)

Sets the direction of the motor, clockwise or counterclockwise

Parameters
dirDirection to set the motor to

Here is the call graph for this function:

void stepperSteps ( unsigned int  steps)

Steps the stepper motor a specified number of steps

Parameters
stepsNumber of steps to move the stepper motor

Here is the call graph for this function:

void release ( )

Releases the stepper motor by removing power

Here is the call graph for this function:

Collaboration diagram for ULN200XA:
Collaboration graph
[legend]

The documentation for this class was generated from the following files: