# Stepper - OSC
[OSC]

Control Stepper motors with the Application Board via OSC. More...

Control Stepper motors with the Application Board via OSC.

Specify settings for your stepper motor by setting whether it's:

- bipolar or unipolar
- normal of half-stepping

You can generally use the stepper motor in 2 modes - absolute positioning or relative positioning.

For absolute positioning, set positionrequested with the desired position, and the motor will move there. You can read back the stepper's position property at any point along the way to determine where it is at a given moment. The board keeps an internal count of how many steps the motor has taken in order to keep track of where it is.

For relative positioning, use the step property to simply move a number of steps from the current position.

## Devices

There are 2 Stepper controllers available on the Application Board, numbered 0 & 1. See the Stepper section in the Application Board user's guide for more information on hooking steppers up to the board.

## Properties

Each stepper controller has eight properties:

- position
- positionrequested
- speed
- duty
- bipolar
- halfstep
- step
- active

Step
  The step property simply tells the motor to take a certain number of steps. This is a write-only value.

  To take 1000 steps with the first stepper, send the message

      /stepper/0/step 1000

Position
  The position property corresponds to the current step position of the stepper motor This value can be both read and written. Writing this value changes where the motor thinks it is. The initial value of this parameter is 0.

  To set the first stepper to step position 10000, send the message

      /stepper/0/position 10000

  Leave the argument value off to read the position of the stepper:

      /stepper/0/position

PositionRequested
  The positionrequested property describes the desired step position of the stepper motor This value can be both read and written. Writing this value changes the motor's destination.

  To set the first stepper to go to position 10000, send the message

      /stepper/0/positionrequested 10000

  Leave the argument value off to read the last requested position of the stepper:

      /stepper/0/positionrequested

Speed
  The speed property corresponds to the speed with which the stepper responds to changes of position. This value is the number of milliseconds between each step. So, a speed of one would be a step every millisecond, or 1000 steps a second.

  Note that not all stepper motors can be stepped quite that fast. If you find your stepper motor acting strangely, experiment with slowing down the speed a bit.

  To set the speed of the first stepper to step at 100ms per step, send a message like

      /stepper/0/speed 100

  Adjust the argument value to one that suits your application.
  Leave the argument value off to read the speed of the stepper:

      /stepper/0/speed

Duty
  The duty property corresponds to the how much of the power supply is to be sent to the stepper. This is handy for when the stepper is static and not being required to perform too much work and reducing its power helps reduce heat dissipation. This value can be both read and written, and the range of values is 0 - 1023. A duty of 0 means the stepper gets no power, and the value of 1023 means the stepper gets full power.

  To set the duty of the first stepper to 500, send a message like

      /stepper/0/duty 500

  Adjust the argument value to one that suits your application.
  Leave the argument value off to read the duty of the stepper:

      /stepper/0/duty

Bipolar
  The bipolar property is set to the style of stepper being used. A value of 1 specifies bipolar (the default) and 0 specifies a unipolar stepper. This value can be both read and written.

HalfStep
  The halfstep property controls whether the stepper is being half stepped or not. A 0 here implies full stepping (the default) and 1 implies a half stepping. This value can be both read and written.

Active
  The active property corresponds to the active state of the stepper. If the stepper is set to be active, no other tasks will be able to write to the same I/O lines. If you're not seeing appropriate responses to your messages to a stepper, check the whether it's locked by sending a message like

      /stepper/1/active