upm  0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
Classes | Public Member Functions | List of all members

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.

uln200xa.jpg

Example driving a stepper motor

// Instantiate a Stepper motor on a ULN200XA Dual H-Bridge.
// 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 uln200xa = new upm_uln200xa.ULN200XA(4096, 8, 9, 10, 11);
uln200xa.setSpeed(5);
System.out.println("Rotating 1 revolution clockwise.");
uln200xa.setDirection(upm_uln200xa.ULN200XA.ULN200XA_DIRECTION_T.DIR_CW);
uln200xa.stepperSteps(4096);
System.out.println("Sleeping for 2 seconds...");
Thread.sleep(2000);
System.out.println("Rotating 1/2 revolution counter clockwise.");
uln200xa.setDirection(upm_uln200xa.ULN200XA.ULN200XA_DIRECTION_T.DIR_CCW);
uln200xa.stepperSteps(2048);
// turn off the power
uln200xa.release();

Classes

class  ULN200XA_DIRECTION_T
 

Public Member Functions

synchronized void delete ()
 
 ULN200XA (int stepsPerRev, int i1, int i2, int i3, int i4)
 
long getMillis ()
 
void initClock ()
 
void setSpeed (int speed)
 
void setDirection (ULN200XA.ULN200XA_DIRECTION_T dir)
 
void stepperSteps (long steps)
 
void release ()
 

Constructor & Destructor Documentation

ULN200XA ( int  stepsPerRev,
int  i1,
int  i2,
int  i3,
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

Member Function Documentation

long getMillis ( )

Returns the number of milliseconds elapsed since initClock() was last called.

Returns
Elapsed milliseconds
void initClock ( )

Resets the clock

void release ( )

Releases the stepper motor by removing power

void setDirection ( ULN200XA.ULN200XA_DIRECTION_T  dir)

Sets the direction of the motor, clockwise or counterclockwise

Parameters
dirDirection to set the motor to
void setSpeed ( int  speed)

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

Parameters
speedSpeed to set the motor to, in RPM
void stepperSteps ( long  steps)

Steps the stepper motor a specified number of steps

Parameters
stepsNumber of steps to move the stepper motor

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