Çok hakim değilim ama, adım ile tur sayısını karıştırmıyorsundur umarım.
Geçen dönem okulda bir proje yapmıştım, 18 derecelik adım sayısına sahip bir step motor kullanmıştım.
1 turu 1 saniyede attığı için de :
#include <Stepper.h> //Step motora ait komutları kullanabilmek için kütüphanesini ekliyoruz.
const int stepsPerRevolution = 20; // demiştim, böylelikle 1 tur için 20 adım atıyordu step motorum(360/18)
Yine iki farklı motor kapısı kullanmıştım ve dönmesi için de bir stepcounter algoritması kurmuştum :
for(int stepperCounter=0; stepperCounter<2; stepperCounter++) //2 times turning.
{
stepperA.step(-stepsPerRevolution); //Section A oppening.
isSectionAOpen = true;
stepperB.step(-stepsPerRevolution); //Section B opening.
isSectionBOpen = true;
// yani, alakalı mı bilmem ama kafanda bir fikir oluşması için paylaşayım dedim.
Teşekkür ederim cevap için. Aslında istediğim motor her saniye içinde 20 adımı atacak.Bir turunu 10 saniyede tamamlayacak.Motor mili dakikada 6 tur yapmış olacak.Elimdeki kod çok hassas bir şekilde çalışıyor fakat minimum 2 saniyelik periyot ayarlayabiliyorum.2 saniyede 40 tur atıyor.
#include <Wire.h>
#include "Sodaq_DS3231.h"
/*
This code keeps time and update the stepper motor STEPS_PER_CYCLE every CYCLE_INTERVAL
*/
// number of steps to advance the stepper motor
const int stepsPerCycle = 40;
// cycle interval in seconds.
const int cycleInterval = 2;
// The number of steps in one full motor rotation
const int stepsInFullRound = 800;
// how fast the stepper motor turns in revolutions per second
const double stepperRevPerSec = 0.1;
const int cycleInterval =1 yapınca motor çalışmıyor.
.....devamını eklemedim.
Kodu kullanacağım saat bu.