Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: StepperMotorUni mbed
Dependents: StepperMotorUni_Hello
Homepage
Sample code for stepper motor operation with StepperMotorUni library¶
4 output pin generates signal for stepper motor driver.

This library can operate in parallel for multiple stepper motors.
The mbed generates pulses on 4 output pins for external driver stage.
The StepperMotorUni library can generate 3 types of pulses.
1 phase drive (wave drive)
#include "mbed.h"
#include "StepperMotorUni.h"
StepperMotorUni motor( p26, p25, p24, p23 );
int main()
{
motor.set_operation_phase_mode( StepperMotorUni::ONE_PHASE );
...
...

2 phase drive
#include "mbed.h"
#include "StepperMotorUni.h"
StepperMotorUni motor( p26, p25, p24, p23 );
int main()
{
motor.set_operation_phase_mode( StepperMotorUni::TWO_PHASE );
...
...

1-2 phase (half step) drive
#include "mbed.h"
#include "StepperMotorUni.h"
StepperMotorUni motor( p26, p25, p24, p23 );
int main()
{
motor.set_operation_phase_mode( StepperMotorUni::HALFSTEP );
...
...

Components pages
Components pages are available for bipolar and unipolar motor libraries