API for the Stepper Motor.
More...
This module defines the Stepper Motor interface. It is compatible with stepper motor drivers that use 2 pins to control the motor, like an Easy Driver from Brian Schmalz.
while (true) {
sensor.stepForward(500);
Thread.sleep(10);
sensor.stepBackwards(500);
Thread.sleep(10);
sensor.setSpeed(750);
sensor.stepForward(500);
Thread.sleep(10);
sensor.stepBackwards(500);
Thread.sleep(10);
sensor.setSpeed(1000);
sensor.stepForward(500);
Thread.sleep(10);
sensor.stepBackwards(500);
Thread.sleep(10);
}
Instantiates a StepMotor object
- Parameters
-
dirPin | Direction GPIO pin |
stePin | Stepper pulse PWM pin |
void setSpeed |
( |
int |
speed | ) |
|
StepMotor object destructor no need for the destructor; all the connections will be closed when m_dirPinCtx and m_pwmStepContext go out of scope ~StepMotor (); Sets the rotation speed
- Parameters
-
int stepBackwards |
( |
int |
ticks | ) |
|
Rotates the motor backward
- Parameters
-
ticks | Number of ticks the motor moves |
int stepForward |
( |
int |
ticks | ) |
|
Rotates the motor forward
- Parameters
-
ticks | Number of ticks the motor moves |
The documentation for this class was generated from the following file:
- /var/lib/jenkins/workspace/upm-doc-stable/build-33/src/stepmotor/StepMotor.java