You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
723 lines
38 KiB
723 lines
38 KiB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> |
|
<title>AccelStepper: AccelStepper Class Reference</title> |
|
<link href="doxygen.css" rel="stylesheet" type="text/css"> |
|
<link href="tabs.css" rel="stylesheet" type="text/css"> |
|
</head><body> |
|
<!-- Generated by Doxygen 1.5.6 --> |
|
<div class="navigation" id="top"> |
|
<div class="tabs"> |
|
<ul> |
|
<li><a href="index.html"><span>Main Page</span></a></li> |
|
<li class="current"><a href="annotated.html"><span>Classes</span></a></li> |
|
<li><a href="files.html"><span>Files</span></a></li> |
|
</ul> |
|
</div> |
|
<div class="tabs"> |
|
<ul> |
|
<li><a href="annotated.html"><span>Class List</span></a></li> |
|
<li><a href="functions.html"><span>Class Members</span></a></li> |
|
</ul> |
|
</div> |
|
</div> |
|
<div class="contents"> |
|
<h1>AccelStepper Class Reference</h1><!-- doxytag: class="AccelStepper" -->Support for stepper motors with acceleration etc. |
|
<a href="#_details">More...</a> |
|
<p> |
|
<code>#include <<a class="el" href="AccelStepper_8h-source.html">AccelStepper.h</a>></code> |
|
<p> |
|
|
|
<p> |
|
<a href="classAccelStepper-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0"> |
|
<tr><td></td></tr> |
|
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr> |
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#a1290897df35915069e5eca9d034038c">AccelStepper</a> (uint8_t pins=4, uint8_t pin1=2, uint8_t pin2=3, uint8_t pin3=4, uint8_t pin4=5)</td></tr> |
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#ce236ede35f87c63d18da25810ec9736">moveTo</a> (long absolute)</td></tr> |
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#68942c66e78fb7f7b5f0cdade6eb7f06">move</a> (long relative)</td></tr> |
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">boolean </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#608b2395b64ac15451d16d0371fe13ce">run</a> ()</td></tr> |
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">boolean </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#a4a6bdf99f698284faaeb5542b0b7514">runSpeed</a> ()</td></tr> |
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#bee8d466229b87accba33d6ec929c18f">setMaxSpeed</a> (float speed)</td></tr> |
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#dfb19e3cd2a028a1fe78131787604fd1">setAcceleration</a> (float acceleration)</td></tr> |
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#e79c49ad69d5ccc9da0ee691fa4ca235">setSpeed</a> (float speed)</td></tr> |
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">float </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#4f0989d0ae264e7eadfe1fa720769fb6">speed</a> ()</td></tr> |
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">long </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#748665c3962e66fbc0e9373eb14c69c1">distanceToGo</a> ()</td></tr> |
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">long </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#96685e0945b7cf75d5959da679cd911e">targetPosition</a> ()</td></tr> |
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">long </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#5dce13ab2a1b02b8f443318886bf6fc5">currentPosition</a> ()</td></tr> |
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#9d917f014317fb9d3b5dc14e66f6c689">setCurrentPosition</a> (long position)</td></tr> |
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#344f58fef8cc34ac5aa75ba4b665d21c">runToPosition</a> ()</td></tr> |
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">boolean </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#9270d20336e76ac1fd5bcd5b9c34f301">runSpeedToPosition</a> ()</td></tr> |
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#176c5d2e4c2f21e9e92b12e39a6f0e67">runToNewPosition</a> (long position)</td></tr> |
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#3591e29a236e2935afd7f64ff6c22006">disableOutputs</a> ()</td></tr> |
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#a279a50d30d0413f570c692cff071643">enableOutputs</a> ()</td></tr> |
|
|
|
<tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr> |
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#ffbee789b5c19165846cf0409860ae79">computeNewSpeed</a> ()</td></tr> |
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#3c9a220819d2451f79ff8a0c0a395b9f">step</a> (uint8_t step)</td></tr> |
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#cc64254ea242b53588e948335fd9305f">step1</a> (uint8_t step)</td></tr> |
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#88f11bf6361fe002585f731d34fe2e8b">step2</a> (uint8_t step)</td></tr> |
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#49e448d179bbe4e0f8003a3f9993789d">step4</a> (uint8_t step)</td></tr> |
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual float </td><td class="memItemRight" valign="bottom"><a class="el" href="classAccelStepper.html#6e4bd79c395e69beee31d76d0d3287e4">desiredSpeed</a> ()</td></tr> |
|
|
|
</table> |
|
<hr><a name="_details"></a><h2>Detailed Description</h2> |
|
Support for stepper motors with acceleration etc. |
|
<p> |
|
This defines a single 2 or 4 pin stepper motor, or stepper moter with fdriver chip, with optional acceleration, deceleration, absolute positioning commands etc. Multiple simultaneous steppers are supported, all moving at different speeds and accelerations.<p> |
|
<dl class="user" compact><dt><b>Operation</b></dt><dd>This module operates by computing a step time in milliseconds. The step time is recomputed after each step and after speed and acceleration parameters are changed by the caller. The time of each step is recorded in milliseconds. The <a class="el" href="classAccelStepper.html#608b2395b64ac15451d16d0371fe13ce">run()</a> function steps the motor if a new step is due. The <a class="el" href="classAccelStepper.html#608b2395b64ac15451d16d0371fe13ce">run()</a> function must be called frequently until the motor is in the desired position, after which time <a class="el" href="classAccelStepper.html#608b2395b64ac15451d16d0371fe13ce">run()</a> will do nothing.</dd></dl> |
|
<dl class="user" compact><dt><b>Positioning</b></dt><dd>Positions are specified by a signed long integer. At construction time, the current position of the motor is consider to be 0. Positive positions are clockwise from the initial position; negative positions are anticlockwise. The curent position can be altered for instance after initialization positioning.</dd></dl> |
|
<dl class="user" compact><dt><b>Caveats</b></dt><dd>This is an open loop controller: If the motor stalls or is oversped, <a class="el" href="classAccelStepper.html" title="Support for stepper motors with acceleration etc.">AccelStepper</a> will not have a correct idea of where the motor really is (since there is no feedback of the motor's real position. We only know where we _think_ it is, relative to the initial starting point).</dd></dl> |
|
The fastest motor speed that can be reliably supported is 1000 steps per second (1 step every millisecond). However any speed less than that down to very slow speeds (much less than one per second) are supported, provided the <a class="el" href="classAccelStepper.html#608b2395b64ac15451d16d0371fe13ce">run()</a> function is called frequently enough to step the motor whenever required. <hr><h2>Constructor & Destructor Documentation</h2> |
|
<a class="anchor" name="a1290897df35915069e5eca9d034038c"></a><!-- doxytag: member="AccelStepper::AccelStepper" ref="a1290897df35915069e5eca9d034038c" args="(uint8_t pins=4, uint8_t pin1=2, uint8_t pin2=3, uint8_t pin3=4, uint8_t pin4=5)" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">AccelStepper::AccelStepper </td> |
|
<td>(</td> |
|
<td class="paramtype">uint8_t </td> |
|
<td class="paramname"> <em>pins</em> = <code>4</code>, </td> |
|
</tr> |
|
<tr> |
|
<td class="paramkey"></td> |
|
<td></td> |
|
<td class="paramtype">uint8_t </td> |
|
<td class="paramname"> <em>pin1</em> = <code>2</code>, </td> |
|
</tr> |
|
<tr> |
|
<td class="paramkey"></td> |
|
<td></td> |
|
<td class="paramtype">uint8_t </td> |
|
<td class="paramname"> <em>pin2</em> = <code>3</code>, </td> |
|
</tr> |
|
<tr> |
|
<td class="paramkey"></td> |
|
<td></td> |
|
<td class="paramtype">uint8_t </td> |
|
<td class="paramname"> <em>pin3</em> = <code>4</code>, </td> |
|
</tr> |
|
<tr> |
|
<td class="paramkey"></td> |
|
<td></td> |
|
<td class="paramtype">uint8_t </td> |
|
<td class="paramname"> <em>pin4</em> = <code>5</code></td><td> </td> |
|
</tr> |
|
<tr> |
|
<td></td> |
|
<td>)</td> |
|
<td></td><td></td><td></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
Constructor. You can have multiple simultaneous steppers, all moving at different speeds and accelerations, provided you call their <a class="el" href="classAccelStepper.html#608b2395b64ac15451d16d0371fe13ce">run()</a> functions at frequent enough intervals. Current Position is set to 0, target position is set to 0. MaxSpeed and Acceleration default to 1.0. The motor pins will be initialised to OUTPUT mode during the constructor by a call to <a class="el" href="classAccelStepper.html#a279a50d30d0413f570c692cff071643">enableOutputs()</a>. <dl compact><dt><b>Parameters:</b></dt><dd> |
|
<table border="0" cellspacing="2" cellpadding="0"> |
|
<tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>pins</em> </td><td>Number of pins to interface to. 1, 2 or 4 are supported. 1 means a stepper driver (with Step and Direction pins) 2 means a 2 wire stepper. 4 means a 4 wire stepper. Defaults to 4 pins. </td></tr> |
|
<tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>pin1</em> </td><td>Arduino digital pin number for motor pin 1. Defaults to pin 2. For a driver (pins==1), this is the Step input to the driver. Low to high transition means to step) </td></tr> |
|
<tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>pin2</em> </td><td>Arduino digital pin number for motor pin 2. Defaults to pin 3. For a driver (pins==1), this is the Direction input the driver. High means forward. </td></tr> |
|
<tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>pin3</em> </td><td>Arduino digital pin number for motor pin 3. Defaults to pin 4. </td></tr> |
|
<tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>pin4</em> </td><td>Arduino digital pin number for motor pin 4. Defaults to pin 5. </td></tr> |
|
</table> |
|
</dl> |
|
|
|
<p>References <a class="el" href="AccelStepper_8cpp-source.html#l00287">enableOutputs()</a>.</p> |
|
|
|
</div> |
|
</div><p> |
|
<hr><h2>Member Function Documentation</h2> |
|
<a class="anchor" name="ce236ede35f87c63d18da25810ec9736"></a><!-- doxytag: member="AccelStepper::moveTo" ref="ce236ede35f87c63d18da25810ec9736" args="(long absolute)" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">void AccelStepper::moveTo </td> |
|
<td>(</td> |
|
<td class="paramtype">long </td> |
|
<td class="paramname"> <em>absolute</em> </td> |
|
<td> ) </td> |
|
<td></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
Set the target position. The <a class="el" href="classAccelStepper.html#608b2395b64ac15451d16d0371fe13ce">run()</a> function will try to move the motor from the current position to the target position set by the most recent call to this function. <dl compact><dt><b>Parameters:</b></dt><dd> |
|
<table border="0" cellspacing="2" cellpadding="0"> |
|
<tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>absolute</em> </td><td>The desired absolute position. Negative is anticlockwise from the 0 position. </td></tr> |
|
</table> |
|
</dl> |
|
|
|
<p>References <a class="el" href="AccelStepper_8cpp-source.html#l00069">computeNewSpeed()</a>.</p> |
|
|
|
<p>Referenced by <a class="el" href="AccelStepper_8cpp-source.html#l00015">move()</a>, and <a class="el" href="AccelStepper_8cpp-source.html#l00311">runToNewPosition()</a>.</p> |
|
|
|
</div> |
|
</div><p> |
|
<a class="anchor" name="68942c66e78fb7f7b5f0cdade6eb7f06"></a><!-- doxytag: member="AccelStepper::move" ref="68942c66e78fb7f7b5f0cdade6eb7f06" args="(long relative)" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">void AccelStepper::move </td> |
|
<td>(</td> |
|
<td class="paramtype">long </td> |
|
<td class="paramname"> <em>relative</em> </td> |
|
<td> ) </td> |
|
<td></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
Set the target position relative to the current position <dl compact><dt><b>Parameters:</b></dt><dd> |
|
<table border="0" cellspacing="2" cellpadding="0"> |
|
<tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>relative</em> </td><td>The desired position relative to the current position. Negative is anticlockwise from the current position. </td></tr> |
|
</table> |
|
</dl> |
|
|
|
<p>References <a class="el" href="AccelStepper_8cpp-source.html#l00009">moveTo()</a>.</p> |
|
|
|
</div> |
|
</div><p> |
|
<a class="anchor" name="608b2395b64ac15451d16d0371fe13ce"></a><!-- doxytag: member="AccelStepper::run" ref="608b2395b64ac15451d16d0371fe13ce" args="()" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">boolean AccelStepper::run </td> |
|
<td>(</td> |
|
<td class="paramname"> </td> |
|
<td> ) </td> |
|
<td></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
Poll the motor and step it if a step is due, implementing accelerations and decelerations to achive the ratget position. You must call this as fequently as possible, but at least once per minimum step interval, preferably in your main loop. <dl class="return" compact><dt><b>Returns:</b></dt><dd>true if the motor is at the target position. </dd></dl> |
|
|
|
<p>References <a class="el" href="AccelStepper_8cpp-source.html#l00069">computeNewSpeed()</a>, and <a class="el" href="AccelStepper_8cpp-source.html#l00023">runSpeed()</a>.</p> |
|
|
|
<p>Referenced by <a class="el" href="AccelStepper_8cpp-source.html#l00299">runToPosition()</a>.</p> |
|
|
|
</div> |
|
</div><p> |
|
<a class="anchor" name="a4a6bdf99f698284faaeb5542b0b7514"></a><!-- doxytag: member="AccelStepper::runSpeed" ref="a4a6bdf99f698284faaeb5542b0b7514" args="()" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">boolean AccelStepper::runSpeed </td> |
|
<td>(</td> |
|
<td class="paramname"> </td> |
|
<td> ) </td> |
|
<td></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
Poll the motor and step it if a step is due, implmenting a constant speed as set by the most recent call to <a class="el" href="classAccelStepper.html#e79c49ad69d5ccc9da0ee691fa4ca235">setSpeed()</a>. <dl class="return" compact><dt><b>Returns:</b></dt><dd>true if the motor was stepped. </dd></dl> |
|
|
|
<p>References <a class="el" href="AccelStepper_8cpp-source.html#l00176">step()</a>.</p> |
|
|
|
<p>Referenced by <a class="el" href="AccelStepper_8cpp-source.html#l00125">run()</a>, and <a class="el" href="AccelStepper_8cpp-source.html#l00305">runSpeedToPosition()</a>.</p> |
|
|
|
</div> |
|
</div><p> |
|
<a class="anchor" name="bee8d466229b87accba33d6ec929c18f"></a><!-- doxytag: member="AccelStepper::setMaxSpeed" ref="bee8d466229b87accba33d6ec929c18f" args="(float speed)" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">void AccelStepper::setMaxSpeed </td> |
|
<td>(</td> |
|
<td class="paramtype">float </td> |
|
<td class="paramname"> <em>speed</em> </td> |
|
<td> ) </td> |
|
<td></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
Sets the maximum permitted speed. the <a class="el" href="classAccelStepper.html#608b2395b64ac15451d16d0371fe13ce">run()</a> function will accelerate up to the speed set by this function. <dl compact><dt><b>Parameters:</b></dt><dd> |
|
<table border="0" cellspacing="2" cellpadding="0"> |
|
<tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>speed</em> </td><td>The desired maximum speed in steps per second. Must be > 0. Speeds of more than 1000 steps per second are unreliable. </td></tr> |
|
</table> |
|
</dl> |
|
|
|
<p>References <a class="el" href="AccelStepper_8cpp-source.html#l00069">computeNewSpeed()</a>.</p> |
|
|
|
</div> |
|
</div><p> |
|
<a class="anchor" name="dfb19e3cd2a028a1fe78131787604fd1"></a><!-- doxytag: member="AccelStepper::setAcceleration" ref="dfb19e3cd2a028a1fe78131787604fd1" args="(float acceleration)" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">void AccelStepper::setAcceleration </td> |
|
<td>(</td> |
|
<td class="paramtype">float </td> |
|
<td class="paramname"> <em>acceleration</em> </td> |
|
<td> ) </td> |
|
<td></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
Sets the acceleration and deceleration parameter. <dl compact><dt><b>Parameters:</b></dt><dd> |
|
<table border="0" cellspacing="2" cellpadding="0"> |
|
<tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>acceleration</em> </td><td>The desired acceleration in steps per second per second. Must be > 0. </td></tr> |
|
</table> |
|
</dl> |
|
|
|
<p>References <a class="el" href="AccelStepper_8cpp-source.html#l00069">computeNewSpeed()</a>.</p> |
|
|
|
</div> |
|
</div><p> |
|
<a class="anchor" name="e79c49ad69d5ccc9da0ee691fa4ca235"></a><!-- doxytag: member="AccelStepper::setSpeed" ref="e79c49ad69d5ccc9da0ee691fa4ca235" args="(float speed)" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">void AccelStepper::setSpeed </td> |
|
<td>(</td> |
|
<td class="paramtype">float </td> |
|
<td class="paramname"> <em>speed</em> </td> |
|
<td> ) </td> |
|
<td></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
Sets the desired constant speed for use with <a class="el" href="classAccelStepper.html#a4a6bdf99f698284faaeb5542b0b7514">runSpeed()</a>. <dl compact><dt><b>Parameters:</b></dt><dd> |
|
<table border="0" cellspacing="2" cellpadding="0"> |
|
<tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>speed</em> </td><td>The desired constant speed in steps per second. Positive is clockwise. Speeds of more than 1000 steps per second are unreliable. Very slow speeds may be set (eg 0.00027777 for once per hour, approximately. Speed accuracy depends on the Arduino crystal. Jitter depends on how frequently you call the <a class="el" href="classAccelStepper.html#a4a6bdf99f698284faaeb5542b0b7514">runSpeed()</a> function. </td></tr> |
|
</table> |
|
</dl> |
|
|
|
<p>Referenced by <a class="el" href="AccelStepper_8cpp-source.html#l00069">computeNewSpeed()</a>.</p> |
|
|
|
</div> |
|
</div><p> |
|
<a class="anchor" name="4f0989d0ae264e7eadfe1fa720769fb6"></a><!-- doxytag: member="AccelStepper::speed" ref="4f0989d0ae264e7eadfe1fa720769fb6" args="()" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">float AccelStepper::speed </td> |
|
<td>(</td> |
|
<td class="paramname"> </td> |
|
<td> ) </td> |
|
<td></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
The most recently set speed <dl class="return" compact><dt><b>Returns:</b></dt><dd>the most recent speed in steps per second </dd></dl> |
|
|
|
</div> |
|
</div><p> |
|
<a class="anchor" name="748665c3962e66fbc0e9373eb14c69c1"></a><!-- doxytag: member="AccelStepper::distanceToGo" ref="748665c3962e66fbc0e9373eb14c69c1" args="()" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">long AccelStepper::distanceToGo </td> |
|
<td>(</td> |
|
<td class="paramname"> </td> |
|
<td> ) </td> |
|
<td></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
The distance from the current position to the target position. <dl class="return" compact><dt><b>Returns:</b></dt><dd>the distance from the current position to the target position in steps. Positive is clockwise from the current position. </dd></dl> |
|
|
|
<p>Referenced by <a class="el" href="AccelStepper_8cpp-source.html#l00084">desiredSpeed()</a>.</p> |
|
|
|
</div> |
|
</div><p> |
|
<a class="anchor" name="96685e0945b7cf75d5959da679cd911e"></a><!-- doxytag: member="AccelStepper::targetPosition" ref="96685e0945b7cf75d5959da679cd911e" args="()" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">long AccelStepper::targetPosition </td> |
|
<td>(</td> |
|
<td class="paramname"> </td> |
|
<td> ) </td> |
|
<td></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
The most recently set target position. <dl class="return" compact><dt><b>Returns:</b></dt><dd>the target position in steps. Positive is clockwise from the 0 position. </dd></dl> |
|
|
|
</div> |
|
</div><p> |
|
<a class="anchor" name="5dce13ab2a1b02b8f443318886bf6fc5"></a><!-- doxytag: member="AccelStepper::currentPosition" ref="5dce13ab2a1b02b8f443318886bf6fc5" args="()" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">long AccelStepper::currentPosition </td> |
|
<td>(</td> |
|
<td class="paramname"> </td> |
|
<td> ) </td> |
|
<td></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
The currently motor position. <dl class="return" compact><dt><b>Returns:</b></dt><dd>the current motor position in steps. Positive is clockwise from the 0 position. </dd></dl> |
|
|
|
</div> |
|
</div><p> |
|
<a class="anchor" name="9d917f014317fb9d3b5dc14e66f6c689"></a><!-- doxytag: member="AccelStepper::setCurrentPosition" ref="9d917f014317fb9d3b5dc14e66f6c689" args="(long position)" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">void AccelStepper::setCurrentPosition </td> |
|
<td>(</td> |
|
<td class="paramtype">long </td> |
|
<td class="paramname"> <em>position</em> </td> |
|
<td> ) </td> |
|
<td></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
Resets the current position of the motor, so that wherever the mottor happens to be right now is considered to be the new position. Useful for setting a zero position on a stepper after an initial hardware positioning move. <dl compact><dt><b>Parameters:</b></dt><dd> |
|
<table border="0" cellspacing="2" cellpadding="0"> |
|
<tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>position</em> </td><td>The position in steps of wherever the motor happens to be right now. </td></tr> |
|
</table> |
|
</dl> |
|
|
|
</div> |
|
</div><p> |
|
<a class="anchor" name="344f58fef8cc34ac5aa75ba4b665d21c"></a><!-- doxytag: member="AccelStepper::runToPosition" ref="344f58fef8cc34ac5aa75ba4b665d21c" args="()" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">void AccelStepper::runToPosition </td> |
|
<td>(</td> |
|
<td class="paramname"> </td> |
|
<td> ) </td> |
|
<td></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
Moves the motor to the target position and blocks until it is at position. Dont use this in event loops, since it blocks. |
|
<p>References <a class="el" href="AccelStepper_8cpp-source.html#l00125">run()</a>.</p> |
|
|
|
<p>Referenced by <a class="el" href="AccelStepper_8cpp-source.html#l00311">runToNewPosition()</a>.</p> |
|
|
|
</div> |
|
</div><p> |
|
<a class="anchor" name="9270d20336e76ac1fd5bcd5b9c34f301"></a><!-- doxytag: member="AccelStepper::runSpeedToPosition" ref="9270d20336e76ac1fd5bcd5b9c34f301" args="()" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">boolean AccelStepper::runSpeedToPosition </td> |
|
<td>(</td> |
|
<td class="paramname"> </td> |
|
<td> ) </td> |
|
<td></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
Runs at the currently selected speed until the target position is reached Does not implement accelerations. |
|
<p>References <a class="el" href="AccelStepper_8cpp-source.html#l00023">runSpeed()</a>.</p> |
|
|
|
</div> |
|
</div><p> |
|
<a class="anchor" name="176c5d2e4c2f21e9e92b12e39a6f0e67"></a><!-- doxytag: member="AccelStepper::runToNewPosition" ref="176c5d2e4c2f21e9e92b12e39a6f0e67" args="(long position)" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">void AccelStepper::runToNewPosition </td> |
|
<td>(</td> |
|
<td class="paramtype">long </td> |
|
<td class="paramname"> <em>position</em> </td> |
|
<td> ) </td> |
|
<td></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
Moves the motor to the new target position and blocks until it is at position. Dont use this in event loops, since it blocks. <dl compact><dt><b>Parameters:</b></dt><dd> |
|
<table border="0" cellspacing="2" cellpadding="0"> |
|
<tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>position</em> </td><td>The new target position. </td></tr> |
|
</table> |
|
</dl> |
|
|
|
<p>References <a class="el" href="AccelStepper_8cpp-source.html#l00009">moveTo()</a>, and <a class="el" href="AccelStepper_8cpp-source.html#l00299">runToPosition()</a>.</p> |
|
|
|
</div> |
|
</div><p> |
|
<a class="anchor" name="3591e29a236e2935afd7f64ff6c22006"></a><!-- doxytag: member="AccelStepper::disableOutputs" ref="3591e29a236e2935afd7f64ff6c22006" args="()" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">void AccelStepper::disableOutputs </td> |
|
<td>(</td> |
|
<td class="paramname"> </td> |
|
<td> ) </td> |
|
<td></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
Disable motor pin outputs by setting them all LOW Depending on the design of your electronics this may turn off the power to the motor coils, saving power. This is useful to support Arduino low power modes: disable the outputs during sleep and then reenable with <a class="el" href="classAccelStepper.html#a279a50d30d0413f570c692cff071643">enableOutputs()</a> before stepping again. |
|
</div> |
|
</div><p> |
|
<a class="anchor" name="a279a50d30d0413f570c692cff071643"></a><!-- doxytag: member="AccelStepper::enableOutputs" ref="a279a50d30d0413f570c692cff071643" args="()" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">void AccelStepper::enableOutputs </td> |
|
<td>(</td> |
|
<td class="paramname"> </td> |
|
<td> ) </td> |
|
<td></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
Enable motor pin outputs by setting the motor pins to OUTPUT mode. Called automatically by the constructor. |
|
<p>Referenced by <a class="el" href="AccelStepper_8cpp-source.html#l00135">AccelStepper()</a>.</p> |
|
|
|
</div> |
|
</div><p> |
|
<a class="anchor" name="ffbee789b5c19165846cf0409860ae79"></a><!-- doxytag: member="AccelStepper::computeNewSpeed" ref="ffbee789b5c19165846cf0409860ae79" args="()" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">void AccelStepper::computeNewSpeed </td> |
|
<td>(</td> |
|
<td class="paramname"> </td> |
|
<td> ) </td> |
|
<td><code> [protected]</code></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
Forces the library to compute a new instantaneous speed and set that as the current speed. Calls <a class="el" href="classAccelStepper.html#6e4bd79c395e69beee31d76d0d3287e4">desiredSpeed()</a>, which can be overridden by subclasses. It is called by the library: <ul> |
|
<li>after each step </li> |
|
<li>after change to maxSpeed through <a class="el" href="classAccelStepper.html#bee8d466229b87accba33d6ec929c18f">setMaxSpeed()</a> </li> |
|
<li>after change to acceleration through <a class="el" href="classAccelStepper.html#dfb19e3cd2a028a1fe78131787604fd1">setAcceleration()</a> </li> |
|
<li>after change to target position (relative or absolute) through <a class="el" href="classAccelStepper.html#68942c66e78fb7f7b5f0cdade6eb7f06">move()</a> or <a class="el" href="classAccelStepper.html#ce236ede35f87c63d18da25810ec9736">moveTo()</a> </li> |
|
</ul> |
|
|
|
<p>References <a class="el" href="AccelStepper_8cpp-source.html#l00084">desiredSpeed()</a>, and <a class="el" href="AccelStepper_8cpp-source.html#l00164">setSpeed()</a>.</p> |
|
|
|
<p>Referenced by <a class="el" href="AccelStepper_8cpp-source.html#l00009">moveTo()</a>, <a class="el" href="AccelStepper_8cpp-source.html#l00125">run()</a>, <a class="el" href="AccelStepper_8cpp-source.html#l00158">setAcceleration()</a>, and <a class="el" href="AccelStepper_8cpp-source.html#l00152">setMaxSpeed()</a>.</p> |
|
|
|
</div> |
|
</div><p> |
|
<a class="anchor" name="3c9a220819d2451f79ff8a0c0a395b9f"></a><!-- doxytag: member="AccelStepper::step" ref="3c9a220819d2451f79ff8a0c0a395b9f" args="(uint8_t step)" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">void AccelStepper::step </td> |
|
<td>(</td> |
|
<td class="paramtype">uint8_t </td> |
|
<td class="paramname"> <em>step</em> </td> |
|
<td> ) </td> |
|
<td><code> [protected, virtual]</code></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
Called to execute a step. Only called when a new step is required. Subclasses may override to implement new stepping interfaces. The default calls <a class="el" href="classAccelStepper.html#cc64254ea242b53588e948335fd9305f">step1()</a>, <a class="el" href="classAccelStepper.html#88f11bf6361fe002585f731d34fe2e8b">step2()</a> or <a class="el" href="classAccelStepper.html#49e448d179bbe4e0f8003a3f9993789d">step4()</a> depending on the number of pins defined for the stepper. <dl compact><dt><b>Parameters:</b></dt><dd> |
|
<table border="0" cellspacing="2" cellpadding="0"> |
|
<tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>step</em> </td><td>The current step phase number (0 to 3) </td></tr> |
|
</table> |
|
</dl> |
|
|
|
<p>References <a class="el" href="AccelStepper_8cpp-source.html#l00197">step1()</a>, <a class="el" href="AccelStepper_8cpp-source.html#l00211">step2()</a>, and <a class="el" href="AccelStepper_8cpp-source.html#l00240">step4()</a>.</p> |
|
|
|
<p>Referenced by <a class="el" href="AccelStepper_8cpp-source.html#l00023">runSpeed()</a>.</p> |
|
|
|
</div> |
|
</div><p> |
|
<a class="anchor" name="cc64254ea242b53588e948335fd9305f"></a><!-- doxytag: member="AccelStepper::step1" ref="cc64254ea242b53588e948335fd9305f" args="(uint8_t step)" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">void AccelStepper::step1 </td> |
|
<td>(</td> |
|
<td class="paramtype">uint8_t </td> |
|
<td class="paramname"> <em>step</em> </td> |
|
<td> ) </td> |
|
<td><code> [protected, virtual]</code></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
Called to execute a step on a stepper drover (ie where pins == 1). Only called when a new step is required. Subclasses may override to implement new stepping interfaces. The default sets or clears the outputs of Step pin1 to step, and sets the output of _pin2 to the desired direction. The Step pin (_pin1) is pulsed for 1 microsecond which is the minimum STEP pulse width for the 3967 driver. <dl compact><dt><b>Parameters:</b></dt><dd> |
|
<table border="0" cellspacing="2" cellpadding="0"> |
|
<tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>step</em> </td><td>The current step phase number (0 to 3) </td></tr> |
|
</table> |
|
</dl> |
|
|
|
<p>Referenced by <a class="el" href="AccelStepper_8cpp-source.html#l00176">step()</a>.</p> |
|
|
|
</div> |
|
</div><p> |
|
<a class="anchor" name="88f11bf6361fe002585f731d34fe2e8b"></a><!-- doxytag: member="AccelStepper::step2" ref="88f11bf6361fe002585f731d34fe2e8b" args="(uint8_t step)" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">void AccelStepper::step2 </td> |
|
<td>(</td> |
|
<td class="paramtype">uint8_t </td> |
|
<td class="paramname"> <em>step</em> </td> |
|
<td> ) </td> |
|
<td><code> [protected, virtual]</code></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
Called to execute a step on a 2 pin motor. Only called when a new step is required. Subclasses may override to implement new stepping interfaces. The default sets or clears the outputs of pin1 and pin2 <dl compact><dt><b>Parameters:</b></dt><dd> |
|
<table border="0" cellspacing="2" cellpadding="0"> |
|
<tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>step</em> </td><td>The current step phase number (0 to 3) </td></tr> |
|
</table> |
|
</dl> |
|
|
|
<p>Referenced by <a class="el" href="AccelStepper_8cpp-source.html#l00176">step()</a>.</p> |
|
|
|
</div> |
|
</div><p> |
|
<a class="anchor" name="49e448d179bbe4e0f8003a3f9993789d"></a><!-- doxytag: member="AccelStepper::step4" ref="49e448d179bbe4e0f8003a3f9993789d" args="(uint8_t step)" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">void AccelStepper::step4 </td> |
|
<td>(</td> |
|
<td class="paramtype">uint8_t </td> |
|
<td class="paramname"> <em>step</em> </td> |
|
<td> ) </td> |
|
<td><code> [protected, virtual]</code></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
Called to execute a step on a 4 pin motor. Only called when a new step is required. Subclasses may override to implement new stepping interfaces. The default sets or clears the outputs of pin1, pin2, pin3, pin4. <dl compact><dt><b>Parameters:</b></dt><dd> |
|
<table border="0" cellspacing="2" cellpadding="0"> |
|
<tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>step</em> </td><td>The current step phase number (0 to 3) </td></tr> |
|
</table> |
|
</dl> |
|
|
|
<p>Referenced by <a class="el" href="AccelStepper_8cpp-source.html#l00176">step()</a>.</p> |
|
|
|
</div> |
|
</div><p> |
|
<a class="anchor" name="6e4bd79c395e69beee31d76d0d3287e4"></a><!-- doxytag: member="AccelStepper::desiredSpeed" ref="6e4bd79c395e69beee31d76d0d3287e4" args="()" --> |
|
<div class="memitem"> |
|
<div class="memproto"> |
|
<table class="memname"> |
|
<tr> |
|
<td class="memname">float AccelStepper::desiredSpeed </td> |
|
<td>(</td> |
|
<td class="paramname"> </td> |
|
<td> ) </td> |
|
<td><code> [protected, virtual]</code></td> |
|
</tr> |
|
</table> |
|
</div> |
|
<div class="memdoc"> |
|
|
|
<p> |
|
Compute and return the desired speed. The default algorithm uses maxSpeed, acceleration and the current speed to set a new speed to move the motor from teh current position to the target position. Subclasses may override this to provide an alternate algorithm (but do not block). Called by computeNewSpeed whenever a new speed neds to be computed. |
|
<p>References <a class="el" href="AccelStepper_8cpp-source.html#l00048">distanceToGo()</a>.</p> |
|
|
|
<p>Referenced by <a class="el" href="AccelStepper_8cpp-source.html#l00069">computeNewSpeed()</a>.</p> |
|
|
|
</div> |
|
</div><p> |
|
<hr>The documentation for this class was generated from the following files:<ul> |
|
<li><a class="el" href="AccelStepper_8h-source.html">AccelStepper.h</a><li>AccelStepper.cpp</ul> |
|
</div> |
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Oct 24 18:22:50 2010 for AccelStepper by |
|
<a href="http://www.doxygen.org/index.html"> |
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address> |
|
</body> |
|
</html>
|
|
|