best regard
i have driver tb6560 3 axis (see attached image) works following code arduino mega.
my question is, serves (pulsewidthmicros) , (microsbetweensteps), if put pin high step in without delay advancing? or refers motor stepper used?
thank you
i have driver tb6560 3 axis (see attached image) works following code arduino mega.
code: [select]
byte directionpin = 9;
byte steppin = 8;
int numberofsteps = 10000;
byte ledpin = 13;
int pulsewidthmicros = 10; // microseconds
int microsbetweensteps = 1; // milliseconds
void setup() {
serial.begin(9600);
serial.println("starting steppertest");
digitalwrite(ledpin, low);
delay(2000);
pinmode(directionpin, output);
pinmode(steppin, output);
pinmode(ledpin, output);
digitalwrite(directionpin, high);
for(int n = 0; n < numberofsteps; n++) {
digitalwrite(steppin, high);
delaymicroseconds(pulsewidthmicros); // line unnecessary
digitalwrite(steppin, low);
delay(microsbetweensteps);
digitalwrite(ledpin, !digitalread(ledpin));
}
delay(3000);
digitalwrite(directionpin, low);
for(int n = 0; n < numberofsteps; n++) {
digitalwrite(steppin, high);
// delaymicroseconds(pulsewidthmicros); // not needed
digitalwrite(steppin, low);
delay(microsbetweensteps);
digitalwrite(ledpin, !digitalread(ledpin));
}
}
void readpotentiometer()
{
const byte potpin = a0;
int potvalue;
potvalue = analogread(potpin);
}
void loop()
{
}
my question is, serves (pulsewidthmicros) , (microsbetweensteps), if put pin high step in without delay advancing? or refers motor stepper used?
thank you
i'm sorry don't understand question.
i don't think there need small delay between digitalwrite(steppin, high) , ...low) because digitalwrite() function slow enough give adequate pulse width. if motor not working uncomment line pulsewidthmicros see if improves matters.
the variable microsbetweensteps governs speed @ steps sent motor.
...r
i don't think there need small delay between digitalwrite(steppin, high) , ...low) because digitalwrite() function slow enough give adequate pulse width. if motor not working uncomment line pulsewidthmicros see if improves matters.
the variable microsbetweensteps governs speed @ steps sent motor.
...r
Arduino Forum > Using Arduino > Motors, Mechanics, and Power (Moderator: fabioc84) > Arduino & TB6560 3 Axis
arduino
Comments
Post a Comment