Tutorial.MotorKnob History

Hide minor edits - Show changes to output

March 29, 2013, at 02:12 PM by Scott Fitzgerald -
Changed line 40 from:
>>id=unipolarCircuit border='1px solid #999' padding=5px bgcolor=#e1e7f1<<
to:
>>id=unipolarCircuit border='1px solid #999' padding=5px bgcolor=#ffffff<<
Changed line 57 from:
>>id=bipolarCircuit border='1px solid #999' padding=5px bgcolor=#e1e7f1<<
to:
>>id=bipolarCircuit border='1px solid #999' padding=5px bgcolor=#ffffff<<
March 29, 2013, at 02:11 PM by Scott Fitzgerald -
Changed lines 37-39 from:

(:toggle question1 init=hide show='Show images for the unipolar circuit and schematic' hide='Hide the unipolar circuit':)
>>id=question1 border='1px solid #999' padding=5px bgcolor=#e1e7f1<<
to:
(:table border=0 cellspacing=5px bgcolor=#e1e7f1:)
(:cell:)
(:toggle unipolarCircuit init=hide show='Show images for the unipolar circuit and schematic' hide='Hide the unipolar circuit':)
>>id=unipolarCircuit border='1px solid #999' padding=5px bgcolor=#e1e7f1<<
Changed lines 50-51 from:

to:
(:tableend:)

Changed lines 54-56 from:

(:toggle question2 init=hide show='Show images for the bipolar circuit and schematic' hide='Hide the bipolar circuit':)
>>id=question2 border='1px solid #999' padding=5px bgcolor=#e1e7f1<<
to:
(:table border=0 cellspacing=5px bgcolor=#e1e7f1:)
(:cell:)
(:toggle bipolarCircuit init=hide show='Show images for the bipolar circuit and schematic' hide='Hide the bipolar circuit':)
>>id=bipolarCircuit border='1px solid #999' padding=5px bgcolor=#e1e7f1<<
Changed lines 67-68 from:
to:
(:tableend:)
Changed line 88 from:
* [[Tutorial/Knob]] - control the position of a servo with a potentiometer.
to:
* [[Tutorial/Knob]] - control the position of a servo with a potentiometer.
March 29, 2013, at 01:29 PM by Scott Fitzgerald -
Changed line 62 from:
%height=250px%[[Attach:bipolarKnob_schlg.png | Attach:biipolarKnob_schms.png]]
to:
%height=250px%[[Attach:bipolarKnob_schlg.png | Attach:bipolarKnob_schms.png]]
March 29, 2013, at 12:48 PM by Scott Fitzgerald -
Changed line 69 from:
to:
'''For both unipolar and bipolar steppers'''
Changed lines 71-72 from:
'''(for both circuits)'''
to:
March 29, 2013, at 12:47 PM by Scott Fitzgerald -
Changed line 54 from:
>>id=question1 border='1px solid #999' padding=5px bgcolor=#e1e7f1<<
to:
>>id=question2 border='1px solid #999' padding=5px bgcolor=#e1e7f1<<
March 29, 2013, at 12:46 PM by Scott Fitzgerald -
Added line 37:
Added line 52:
Added line 64:
Deleted lines 67-68:

March 29, 2013, at 12:35 PM by Scott Fitzgerald -
Changed line 37 from:
(:toggle Unipolar init=hide show='Show images for the unipolar circuit and schematic' hide='Hide the unipolar circuit':)
to:
(:toggle question1 init=hide show='Show images for the unipolar circuit and schematic' hide='Hide the unipolar circuit':)
Changed line 51 from:
(:toggle Bipolar init=hide show='Show images for the bipolar circuit and schematic' hide='Hide the bipolar circuit':)
to:
(:toggle question2 init=hide show='Show images for the bipolar circuit and schematic' hide='Hide the bipolar circuit':)
March 29, 2013, at 12:34 PM by Scott Fitzgerald -
Changed line 37 from:
(:toggle question1 init=hide show='Show images for the unipolar circuit and schematic' hide='Hide the unipolar circuit':)
to:
(:toggle Unipolar init=hide show='Show images for the unipolar circuit and schematic' hide='Hide the unipolar circuit':)
Changed line 51 from:
(:toggle question1 init=hide show='Show images for the bipolar circuit and schematic' hide='Hide the bipolar circuit':)
to:
(:toggle Bipolar init=hide show='Show images for the bipolar circuit and schematic' hide='Hide the bipolar circuit':)
March 29, 2013, at 12:31 PM by Scott Fitzgerald -
Changed lines 36-38 from:
'''Unipolar Stepper Circuit'''

%height=300px%[[Attach:Unipolar_bb.png | Attach:Unipolar_bb.png]]
to:
!!!!Unipolar Stepper Circuit and schematic
(:toggle question1 init=hide show='Show images for the unipolar circuit and schematic' hide='Hide the unipolar circuit':)
>>id=question1 border='1px solid #999' padding=5px bgcolor=#e1e7f1<<
'''Unipolar Motor Knob Circuit'''

%height=300px%[[Attach:UnipolarKnob_bblg.png | Attach:UnipolarKnob_bbsm.png]]
Changed lines 44-51 from:
'''Unipolar Circuit Schematic'''

%height=250px%[[Attach:Unipolar_sch.jpeg | Attach:Unipolar_sch.jpeg]]


'''Bipolar Stepper Circuit'''

%height=300px%[[Attach:bipolar_bb.png | Attach:bipolar_bb.png]]
to:
'''Unipolar Motor Knob Schematic'''

%height=250px%[[Attach:UnipolarKnob_schlg.png | Attach:UnipolarKnob_schms.png]]
>><<


!!!!Bipolar Stepper Circuit and schematic
(:toggle question1 init=hide show='Show images for the bipolar circuit and schematic' hide='Hide the bipolar circuit':)
>>id=question1 border='1px solid #999' padding=5px bgcolor=#e1e7f1<<
'''Bipolar Motor Knob Circuit'''

%height=300px%[[Attach:bipolarKnob_bblg.png | Attach:bipolarKnob_bbsm.png]]
Changed lines 58-63 from:

'''Bipolar Stepper Schematic'''

%height=300px%[[Attach:bipolar_schem.jpeg | Attach:bipolar_schem.jpeg]]

to:
'''Bipolar Motor Knob Schematic'''

%height=250px%[[Attach:bipolarKnob_schlg.png | Attach:biipolarKnob_schms.png]]
>><<
Deleted lines 84-86:


March 28, 2013, at 09:23 AM by Scott Fitzgerald -
Changed lines 7-10 from:
There are two types of steppers, Unipolars and Bipolars, and it is very important to know which type you are working with. For more information about the differences of the two types, and about the circuits that must be built to control a stepper, please take a look at [[http://www.tigoe.net/pcomp/code/circuits/motors/stepper-motors | '''Tom Igoe's page on stepper motors'''.]]

In this example, the turns of a potentiometer (or other sensor) on analog input 0 are used to control the movement of a stepper motor while using the [[Reference/Stepper |''' Arduino Stepper Library''']]. The [[Reference/StepperUnipolarCircuit | unipolar]] or [[Reference/ StepperBipolarCircuit | bipolar]] stepper is controlled by using digital pins 8, 9, 10, and 11 in conjunction with either a [[http://octopart.com/uln2004a-stmicroelectronics-4798 | U2004 Darlington Array]] (for unipolar steppers) or a [[http://octopart.com/sn754410ne-texas+instruments-1320 | SN754410NE H-Bridge]] (for bipolars).
to:
There are two types of steppers, Unipolars and Bipolars, and it is very important to know which type you are working with. For each of the motors, there is a different circuit. The example code will control both kinds of motors. See the [[Reference/StepperUnipolarCircuit | unipolar]] and [[Reference/ StepperBipolarCircuit | bipolar]] motor schematics for information on how to wire up your motor.

In this example, a potentiometer (or other sensor) on analog input 0 is used to control the movement of a stepper motor using the [[Reference/Stepper | Arduino Stepper Library]]. The stepper is controlled by with digital pins 8, 9, 10, and 11 for either unipolar or bipolar motors.

The Arduino will connect to a [[http://octopart.com/uln2004a-stmicroelectronics-4798 | U2004 Darlington Array]] if you're using a unipolar stepper or a [[http://octopart.com/sn754410ne-texas+instruments-1320 | SN754410NE H-Bridge]] if you have a bipolar motor.

For more information about the differences of the two types, please take a look at [[http://www.tigoe.net/pcomp/code/circuits/motors/stepper-motors | Tom Igoe's page on stepper motors]].
Deleted line 82:
November 16, 2011, at 04:40 AM by Scott Fitzgerald -
Changed lines 63-64 from:
(:source http://arduino.cc/en/pub/code/master/libraries/Stepper/examples/MotorKnob/MotorKnob.pde lang=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/master/libraries/Stepper/examples/MotorKnob/MotorKnob.ino lang=arduino tabwidth=4:)
September 23, 2010, at 10:55 PM by Christian Cerrito -
Changed lines 3-4 from:
!!Motor Knob
to:
!!! Stepper Motor Knob
September 23, 2010, at 12:45 PM by Tom Igoe -
Changed lines 63-64 from:
(:sourcehttp://arduino.cc/en/pub/code/master/libraries/Stepper/examples/MotorKnob/MotorKnob.pde lang=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/master/libraries/Stepper/examples/MotorKnob/MotorKnob.pde lang=arduino tabwidth=4:)
September 23, 2010, at 12:44 PM by Tom Igoe -
Changed lines 63-95 from:
(:source lang=arduino tabwidth=4:)
#include <Stepper.h>

// change this to the number of steps on your motor
#define STEPS 100

// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
Stepper stepper(STEPS, 8, 9, 10, 11);

// the previous reading from the analog input
int previous = 0;

void setup()
{
// set the speed of the motor to 30 RPMs
stepper.setSpeed(30);
}

void loop()
{
// get the sensor value
int val = analogRead(A0);

// move a number of steps equal to the change in the
// sensor reading
stepper.step(val - previous);

// remember the previous value of the sensor
previous = val;
}
(:sourceend:)
to:
(:sourcehttp://arduino.cc/en/pub/code/master/libraries/Stepper/examples/MotorKnob/MotorKnob.pde lang=arduino tabwidth=4:)
September 23, 2010, at 08:00 AM by Christian Cerrito -
Added lines 105-110:
* [[Tutorial/Sweep]] - sweep the shaft of a servo motor back and forth.
* [[Tutorial/Knob]] - control the position of a servo with a potentiometer.



September 23, 2010, at 07:59 AM by Christian Cerrito -
Changed lines 61-62 from:
(for both circuits)
to:
'''(for both circuits)'''
Changed lines 100-101 from:

* [[Reference/Stepper | Stepper library reference]]
to:
* [[Reference/StepperConstructor | @@Stepper myStepper = Stepper(steps, pin1, pin2, pin3, pin4)@@]]
* [[Reference/StepperSetSpeed | @@stepper.setSpeed()@@ ]]
* [[Reference/StepperStep | @@stepper.step()@@ ]]

* [[Reference/Stepper | Stepper library reference]]
September 23, 2010, at 07:54 AM by Christian Cerrito -
September 23, 2010, at 07:52 AM by Christian Cerrito -
Added line 60:
(:div class=code :)
Changed lines 96-97 from:

to:
(:divend:)

September 23, 2010, at 07:50 AM by Christian Cerrito -
Changed lines 48-49 from:
'"Bipolar Stepper Schematic'''
to:
'''Bipolar Stepper Schematic'''
September 23, 2010, at 07:48 AM by Christian Cerrito -
Changed lines 50-52 from:
%height=300px%[[Attach:bipolar_bb.jpeg | Attach:bipolar_bb.jpeg]]

to:
%height=300px%[[Attach:bipolar_schem.jpeg | Attach:bipolar_schem.jpeg]]

September 23, 2010, at 07:47 AM by Christian Cerrito -
Changed lines 32-33 from:
'''Unipolar Stepper'''
to:
'''Unipolar Stepper Circuit'''
Changed lines 37-38 from:
'''Unipolar Schematic'''
to:
'''Unipolar Circuit Schematic'''
Changed lines 42-43 from:
'''Bipolar Stepper'''
to:
'''Bipolar Stepper Circuit'''
Changed lines 48-52 from:
to:
'"Bipolar Stepper Schematic'''

%height=300px%[[Attach:bipolar_bb.jpeg | Attach:bipolar_bb.jpeg]]

Added lines 60-61:
(for both circuits)
September 23, 2010, at 07:43 AM by Christian Cerrito -
Changed line 34 from:
%height=250px%[[Attach:Unipolar_bb.png | Attach:Unipolar_bb.png]]
to:
%height=300px%[[Attach:Unipolar_bb.png | Attach:Unipolar_bb.png]]
Added lines 40-44:


'''Bipolar Stepper'''

%height=300px%[[Attach:bipolar_bb.png | Attach:bipolar_bb.png]]
September 23, 2010, at 07:41 AM by Christian Cerrito -
Added lines 37-43:
'''Unipolar Schematic'''

%height=250px%[[Attach:Unipolar_sch.jpeg | Attach:Unipolar_sch.jpeg]]
[-image developed using [[http://www.fritzing.org |Fritzing]]. For more circuit examples, see the [[http://fritzing.org/projects/|Fritzing project page]] -]


September 23, 2010, at 07:38 AM by Christian Cerrito -
Added lines 28-29:
In both circuits, connect a 10k pot to power and ground, with it's wiper outputting to analog pin 0.
September 23, 2010, at 07:36 AM by Christian Cerrito -
Changed line 32 from:
%height=250px%[[Attach:Arduino_bb.png | Attach:Arduino_bb.png]]
to:
%height=250px%[[Attach:Unipolar_bb.png | Attach:Unipolar_bb.png]]
September 23, 2010, at 07:12 AM by Christian Cerrito -
Changed lines 10-12 from:
'
!!!!Code
to:

(:div class=BOM :)
!!!Hardware Required
* Arduino Board
* potentiometer
* stepper motor
* U2004 Darlington Array (if using a unipolar stepper)
* SN754410ne H-Bridge (if using a bipolar stepper)
(:divend:)
* power supply appropriate for your particular stepper
* breadboard
* hookup wire
(:divend:)

!!!Circuits
(:div class=circuit :)
Below you'll find circuits for both unipolar and bipolar steppers. In either case, it is best to power your stepper motors from an external supply, as they draw too much to be powered directly from your Arduino board.

''Note: Both circuits below are four wire configurations. Two wire configurations will not work with the code provided.''

'''Unipolar Stepper'''

%height=250px%[[Attach:Arduino_bb.png | Attach:Arduino_bb.png]]
[-image developed using [[http://www.fritzing.org |Fritzing]]. For more circuit examples, see the [[http://fritzing.org/projects/|Fritzing project page]] -]

(:divend:)




!!!Code
September 23, 2010, at 07:01 AM by Christian Cerrito -
Changed lines 5-6 from:
Stepper motors are motors that, due to their design, can be controlled to a high degree of accuracy without any feedback mechanisms. The shaft of a stepper, mounted with a series of magnets, is controlled by a series of electromagnetic coils that are charged positively and negatively in a specific sequence, precisely moving it forward or backward in small "steps".
to:
Stepper motors, due to their unique design, can be controlled to a high degree of accuracy without any feedback mechanisms. The shaft of a stepper, mounted with a series of magnets, is controlled by a series of electromagnetic coils that are charged positively and negatively in a specific sequence, precisely moving it forward or backward in small "steps".
September 23, 2010, at 07:00 AM by Christian Cerrito -
Changed lines 7-10 from:
There are two types of steppers, Unipolars and Bipolars, and it is very important to know which type you are working with. For more information about the differences of the two types, and about the circuits that must be built to control a stepper, please take a look at Tom Igoe's [[http://www.tigoe.net/pcomp/code/circuits/motors/stepper-motors | '''page on stepper motors'''.]]

In this example, the turns of a potentiometer (or other sensor) on analog input 0 are used to control the movement of a stepper motor while using the [[Reference/Stepper | Arduino Stepper Library]]. The [[Reference/StepperUnipolarCircuit | unipolar]] or [[Reference/ StepperBipolarCircuit | bipolar]] stepper is controlled by using digital pins 8, 9, 10, and 11 in conjunction with either a U2004 Darlington Array (for unipolar steppers) or a SN754410NE H-Bridge (for bipolars)
'''Add a link to tom's stepper pages'''
to:
There are two types of steppers, Unipolars and Bipolars, and it is very important to know which type you are working with. For more information about the differences of the two types, and about the circuits that must be built to control a stepper, please take a look at [[http://www.tigoe.net/pcomp/code/circuits/motors/stepper-motors | '''Tom Igoe's page on stepper motors'''.]]

In this example, the turns of a potentiometer (or other sensor) on analog input 0 are used to control the movement of a stepper motor while using the [[Reference/Stepper |''' Arduino Stepper Library''']]. The [[Reference/StepperUnipolarCircuit | unipolar]] or [[Reference/ StepperBipolarCircuit | bipolar]] stepper is controlled by using digital pins 8, 9, 10, and 11 in conjunction with either a [[http://octopart.com/uln2004a-stmicroelectronics-4798 | U2004 Darlington Array]] (for unipolar steppers) or a [[http://octopart.com/sn754410ne-texas+instruments-1320 | SN754410NE H-Bridge]] (for bipolars).
'
September 23, 2010, at 06:57 AM by Christian Cerrito -
Changed lines 5-6 from:
Stepper motors are motors that, due to their design, can be controlled to a high degree of accuracy without any feedback mechanisms. The shaft of a stepper, mounted with a series of magnets, is controlled by a series of electromagnetic coils that are charged positively and negatively in a specific sequence, precisely turning it in small "steps".
to:
Stepper motors are motors that, due to their design, can be controlled to a high degree of accuracy without any feedback mechanisms. The shaft of a stepper, mounted with a series of magnets, is controlled by a series of electromagnetic coils that are charged positively and negatively in a specific sequence, precisely moving it forward or backward in small "steps".
Changed line 9 from:
In this example, the turns of a potentiometer (or other sensor) on analog input 0 are used to control the movement of a stepper motor using the Arduino Stepper Library. The [[Reference/StepperUnipolarCircuit | unipolar]] or [[Reference/ StepperBipolarCircuit | bipolar]] stepper is controlled by using digital pins 8, 9, 10, and 11 in conjunction with either a U2004 Darlington Array (for unipolar steppers) or a SN754410NE H-Bridge (for bipolars)
to:
In this example, the turns of a potentiometer (or other sensor) on analog input 0 are used to control the movement of a stepper motor while using the [[Reference/Stepper | Arduino Stepper Library]]. The [[Reference/StepperUnipolarCircuit | unipolar]] or [[Reference/ StepperBipolarCircuit | bipolar]] stepper is controlled by using digital pins 8, 9, 10, and 11 in conjunction with either a U2004 Darlington Array (for unipolar steppers) or a SN754410NE H-Bridge (for bipolars)
September 23, 2010, at 06:55 AM by Christian Cerrito -
Changed lines 7-8 from:
There are two types of steppers, Unipolars and Bipolars, and it is very important to know which type you are working with. For more information about the differences of the two types, and about the circuits that must be built to control a stepper, please take a look at Tom Igoe's [[http://www.tigoe.net/pcomp/code/circuits/motors/stepper-motors | '''page on stepper motors''.]]
to:
There are two types of steppers, Unipolars and Bipolars, and it is very important to know which type you are working with. For more information about the differences of the two types, and about the circuits that must be built to control a stepper, please take a look at Tom Igoe's [[http://www.tigoe.net/pcomp/code/circuits/motors/stepper-motors | '''page on stepper motors'''.]]
September 23, 2010, at 06:55 AM by Christian Cerrito -
Changed lines 5-8 from:
Stepper motors are motors that, due to their design, can be controlled to a high degree of accuracy without any feedback mechanisms. The shaft of a stepper, mounted with a series of magnets, is controlled by a series of electromagnetic coils that are charged positively and negatively in a specific sequence, precisely turning it in small "steps".

In this example, the turns of a potentiometer (or other sensor) on analog input 0 are used to control the movement of a stepper motor using the Arduino Stepper Library. The [[Reference/StepperUnipolarCircuit | unipolar]] or [[Reference/ StepperBipolarCircuit | bipolar]] stepper is controlled with pins 8, 9, 10, and 11, using one of the circuits on the linked pages.
to:
Stepper motors are motors that, due to their design, can be controlled to a high degree of accuracy without any feedback mechanisms. The shaft of a stepper, mounted with a series of magnets, is controlled by a series of electromagnetic coils that are charged positively and negatively in a specific sequence, precisely turning it in small "steps".

There are two types of steppers, Unipolars and Bipolars, and it is very important to know which type you are working with. For more information about the differences of the two types, and about the circuits that must be built to control a stepper, please take a look at Tom Igoe's [[http://www.tigoe.net/pcomp/code/circuits/motors/stepper-motors | '''page on stepper motors''.]]

In this example, the turns of a potentiometer (or other sensor) on analog input 0 are used to control the movement of a stepper motor using the Arduino Stepper Library. The [[Reference/StepperUnipolarCircuit | unipolar]] or [[Reference/ StepperBipolarCircuit | bipolar]] stepper is controlled by using digital pins 8, 9, 10, and 11 in conjunction with either a U2004 Darlington Array (for unipolar steppers) or a SN754410NE H-Bridge (for bipolars)
September 23, 2010, at 06:44 AM by Christian Cerrito -
Changed lines 5-8 from:
!!!!Description

A stepper motor follows the turns of a potentiometer (or other sensor) on analog input 0. The [[Reference/StepperUnipolarCircuit | unipolar]] or [[Reference/ StepperBipolarCircuit | bipolar]] stepper is controlled with pins 8, 9, 10, and 11, using one of the circuits on the linked pages.
to:
Stepper motors are motors that, due to their design, can be controlled to a high degree of accuracy without any feedback mechanisms. The shaft of a stepper, mounted with a series of magnets, is controlled by a series of electromagnetic coils that are charged positively and negatively in a specific sequence, precisely turning it in small "steps".

In this example, the turns of a potentiometer (or other sensor) on analog input 0 are used to control the movement of a stepper motor using the Arduino Stepper Library. The [[Reference/StepperUnipolarCircuit | unipolar]] or [[Reference/ StepperBipolarCircuit | bipolar]] stepper is controlled with pins 8, 9, 10, and 11, using one of the circuits on the linked pages.
September 20, 2010, at 05:19 PM by Tom Igoe -
Added line 9:
'''Add a link to tom's stepper pages'''
September 17, 2010, at 12:01 AM by Tom Igoe -
Changed lines 34-35 from:
int val = analogRead(0);
to:
int val = analogRead(A0);
September 16, 2010, at 11:29 PM by Tom Igoe -
Changed line 11 from:
[@
to:
(:source lang=arduino tabwidth=4:)
Changed lines 43-44 from:
@]
to:
(:sourceend:)

May 22, 2008, at 04:40 AM by David A. Mellis -
Changed lines 45-46 from:
!!!! See Also
to:
!!!! See also
May 22, 2008, at 04:40 AM by David A. Mellis -
Changed lines 43-47 from:
@]
to:
@]

!!!! See Also

* [[Reference/Stepper | Stepper library reference]]
May 22, 2008, at 04:37 AM by David A. Mellis -
Changed lines 7-8 from:
A stepper motor follows the turns of a potentiometer (or other sensor) on analog input 0. The [[StepperUnipolarCircuit | unipolar]] or [[StepperBipolarCircuit | bipolar]] stepper is controlled with pins 8, 9, 10, and 11, using one of the circuits on the linked pages.
to:
A stepper motor follows the turns of a potentiometer (or other sensor) on analog input 0. The [[Reference/StepperUnipolarCircuit | unipolar]] or [[Reference/ StepperBipolarCircuit | bipolar]] stepper is controlled with pins 8, 9, 10, and 11, using one of the circuits on the linked pages.
May 22, 2008, at 04:36 AM by David A. Mellis -
Added lines 1-43:
''Examples > Stepper Library''

!!Motor Knob

!!!!Description

A stepper motor follows the turns of a potentiometer (or other sensor) on analog input 0. The [[StepperUnipolarCircuit | unipolar]] or [[StepperBipolarCircuit | bipolar]] stepper is controlled with pins 8, 9, 10, and 11, using one of the circuits on the linked pages.

!!!!Code

[@
#include <Stepper.h>

// change this to the number of steps on your motor
#define STEPS 100

// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
Stepper stepper(STEPS, 8, 9, 10, 11);

// the previous reading from the analog input
int previous = 0;

void setup()
{
// set the speed of the motor to 30 RPMs
stepper.setSpeed(30);
}

void loop()
{
// get the sensor value
int val = analogRead(0);

// move a number of steps equal to the change in the
// sensor reading
stepper.step(val - previous);

// remember the previous value of the sensor
previous = val;
}
@]

Share