upm  0.1.8
Sensor/Actuator repository for libmraa (v0.4.5)
 All Data Structures Files Functions Variables Macros Pages
Public Member Functions
StepMotor Class Reference

C++ API for StepMotor Drivers. More...

Detailed Description

This file defines the stepmotor C++ interface for libstepmotor

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 pin
stePinsteper pulse 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: