StepperOut.swfMove a stepper motor to a certain position

The StepperOut widget works with the Arduino and Adafruit Motor/Stepper/Servo Shield v2, and positions a stepper motor to a specific location in steps relative to the initial start location.

It has two modes:

  1. Threshold – the widget will send the stepper to the “pos” as indicated in the interface when the main inputSource is greater or equal to the threshold (defaults to 500). The position can be optionally set by the input called inputStepperPos as set in the parameters.
  2. Continuous – With the continuousPosition parameter check true, whenever a new input value is received from the input inputStepperPos, the stepper will move to that new location.

NOTE: StepperOut requires the arduinoStepper (get it from Github) sketch to be uploaded to the Arduino. This means that other NETLab Toolkit widgets (except for StepperIn) cannot communicate with that Arduino since the Firmata sketch is not running on the Arduino. (But it is possible to run more than one Arduino, where one is dedicated to the stepper motors, and another runs Firmata and works with all the normal widgets.)

On Screen Features

  • connect – Connects to an Arduino running the netlabtoolkitStepper sketch
  • in – Shows the values coming from the inputSource as well as the instance name of the inputSource
  • id – Sets the stepper motor numeric ID
  • pos – Sets the position the stepper will move to
  • spd – Sets the maximum speed that the motor will move at. Note that speed is also affected by the acceleration parameter since the netlabtoolkitStepper software uses easing to accelerate and decelerate the motor as it starts and finishes its move.
  • send stepper move – This button indicates when a move request is sent to the stepper. If clicked manually, it will move the stepper to the position set in the widget. Typically used to make sure the motor is working without the need for an input to the widget.


  • acceleration – Sets how fast the stepper will accelerate at the beginning of the move, and decelerate at the end of the move. 300 is the default.
  • continuousPosition – If set to TRUE, any values from the inputStepperPos source will cause the stepper to move that that location, essentially following the values as they come in. If set to FALSE, values received form inputStepperPos will set the pos value in the interface, and the next time the inputSource goes over the threshold, the stepper will move to the last location set for pos.
  • inputSource – The instance name of the source the widget listens to, e.g AnalogIn or DigitalIn for moving the stepper when the input value rises above the THRESHOLD parameter setting.
  • inputStepperPos – the name of the widget used for setting the next stepper position
  • invisible – If set to “yes”, the widget will disappear when the Flash movie is run
  • threshold – Sets the threshold value where the stepper will move if the value from inputSource is equal to or greater than this number.
  • remoteHubIP – This sets the IP address of the Hub where the widget will get input values from a microcontroller.
  • serialPort – The USB serial port name that the device is connected to. On the Mac connected to an Arduino, you can leave the default (/dev/cu.usb*) if only one device is hooked up (for device other than an Arduino, check the Hub listing of serial devices to see the name of your serial device). On the PC, replace this with the COM port used, e.g. COM7. For more detailed info on how to set this parameter, see the common features for all widgets discussion here.
  • threshold – The value used for triggering a move of the stepper, when the inputSource values are greater than or equal this setting.

Code Examples

These assume a StepperOut widget with the instance name of myStepper.

moveStepper(id, position, speed, acceleration)

Move a specific stepper  to a position at a specified speed and acceleration

   // tell the stepper with an id of 1, move to a position of 200 steps (one rotation), speed of 300, acceleration of 300
   myStepper.moveStepper(1, 200, 300, 300);

   // alternatively, send only the new position for stepper 1
   // with the speed and acceleration set in the widget


stopStepper(id, speed, acceleration)

Stop the stepper.

   // to stop stepper id=1 where it is


   // or, stop the stepper with different speed and acceleration
   // typically, you would do this to stop it faster,
   // using high values for speed and acceleration like 1000



Causes the widget to connect to the controller, the same result as using the connect button.



Causes the widget to disconnect from the controller.


Last modified December 26th, 2013