停止パラメーターとして遅延を使用して、ステッピング モーターを特定の回数 (完全な 1 回転に対して) 停止する必要があります。遅延値がこの数 (20 ) 完全な 1 回転の場合。これらの停止 (20) に for ループを使用しましたが、delys が 20 を超えます。arduino のコードを以下に示します。ここで、8000 は 1 回転のステップ数です。
#include <Stepper.h>
const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 10, 9, 11);
void setup() {
// set the speed at 60 rpm:
myStepper.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);
}
// step one revolution in one direction:
void loop() {
int noi=20;// set the no of images here
for(int i=0;i<=noi;i++){
delay(8000/noi);
}
Serial.println("clockwise");
myStepper.step(stepsPerRevolution);
}