/*
* MotorKnob
*
* A stepper motor follows the turns of a potentiometer
* (or other sensor) on analog input 0.
*
* http://www.arduino.cc/en/Reference/Stepper
* This example code is in the public domain.
*/#include// change this to the number of steps on your motor#define STEPS 200// 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,2,3,4,5);// the previous reading from the analog inputint previous =0;voidsetup(){// set the speed of the motor to 90 RPMs
stepper.setSpeed(90);}voidloop(){// get the sensor valueint 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;}