upm  0.2.0
Sensor/Actuator repository for libmraa (v0.6.1)
Public Member Functions

C++ API for the Stepper motor library. More...

Detailed Description

This file defines the stepmotor C++ interface

sensor = new upm::StepMotor(4, 6);
while (!doWork) {
sensor->setSpeed (500);
sensor->stepForward (500);
usleep (10000);
sensor->stepBackwards (500);
usleep (10000);
sensor->setSpeed (750);
sensor->stepForward (500);
usleep (10000);
sensor->stepBackwards (500);
usleep (10000);
sensor->setSpeed (1000);
sensor->stepForward (500);
usleep (10000);
sensor->stepBackwards (500);
usleep (10000);
}
delete sensor;

Public Member Functions

 StepMotor (int dirPin, int stePin)
 
 ~StepMotor ()
 
void setSpeed (int speed)
 
mraa_result_t stepForward (int ticks)
 
mraa_result_t stepBackwards (int ticks)
 

Constructor & Destructor Documentation

StepMotor ( int  dirPin,
int  stePin 
)

Instanciates a StepMotor object

Parameters
dirPindirection GPIO pin
stePinsteper pulse PWM pin
~StepMotor ( )

StepMotor object destructor.

Member Function Documentation

void setSpeed ( int  speed)

Set the speed of rotation

Parameters
speedrotation speed
mraa_result_t stepForward ( int  ticks)

Rotate motor forward

Parameters
ticksnumber of tickes the motor will move
mraa_result_t stepBackwards ( int  ticks)

Rotate motor backward

Parameters
ticksnumber of tickes the motor will move

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