thank you
my driver is TB6600
my motor is 2 phase and 200 step 1 amp
my code is this:
#include <Stepper.h>
#include <LiquidCrystal.h>//Library for LCD
LiquidCrystal lcd(9, 10, 11, 2, 3, 4, 5);
const int stepsPerRevolution = 1600; // change this to fit the number of steps per revolution
// for your motor
const int stepPin = 6; //PUL -Pulse
const int dirPin = 7; //DIR -Direction
const int enPin = 8; //ENA -Enable
int c = 3;
float timing = 2 ;//minute
float rpm = 300;
Stepper myStepper(stepsPerRevolution, 6,7);
void setup() {
// initialize the serial port:
Serial.begin(9600);
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
pinMode(enPin,OUTPUT);
digitalWrite(enPin,LOW);
pinMode(dirPin,LOW);
lcd.begin(16, 2);//LCD type
lcd.setCursor(0,0);//setting LCD cursor and printing on it
lcd.print("SNS");
delay(3000);
lcd.clear ();//Clearing the LCD screen
}
void loop() {
Cycle();
digitalWrite(enPin,HIGH);
}
void Cycle(){
int cycle = 1;
for(cycle ;cycle <= c; cycle++){
float motorSpeed = 4.25531914893617rpm;
//set the motor speed:
int i = 0;
float t= rpmtiming;
for(i;i<t;i++){
if (motorSpeed > 0) {
myStepper.setSpeed(motorSpeed);
// step revolution:
myStepper.step(6400);
if(rpm >= 282){
rpm = 300;
}
if(rpm <= 0.5){
rpm = 0.5;
}
lcd.setCursor(0,0);
lcd.print("RPM");
lcd.setCursor(0,1);
lcd.print(rpm);
lcd.setCursor(5,0);
lcd.print("TIME");
lcd.setCursor(5,1);
lcd.print(timing);
lcd.setCursor(8,1);
lcd.print("min");
lcd.setCursor(10,0);
lcd.print("CYCLE");
lcd.setCursor(12,1);
lcd.print(cycle);
}
}
delay(10);
digitalWrite(enPin,HIGH);
delay(10000);
digitalWrite(enPin,LOW);
}
}