Arduino and TB6600 setup
Arduino and TB6600 setup
int dirpin = 8;
int steppin = 9;
int enable = 7;
void setup()
{
pinMode(dirpin, OUTPUT);
pinMode(steppin, OUTPUT);
digitalWrite(enable, HIGH);
}
void loop()
{
int i;
digitalWrite(dirpin, HIGH); // Set the direction.
delay(100);
for (i = 0; i<4000; i++) // Iterate for 4000 microsteps.
{
digitalWrite(steppin, LOW); // This LOW to HIGH change is what creates the
delayMicroseconds(400); Ensure that dip switches are set correctly.
Adjust current as outlined on the M1,M2,M3 NOT ALL in ON or OFF position (see
digitalWrite(steppin, HIGH);
board. Use multi-meter to table below
delayMicroseconds(400); // This delay time is close to top speed for this
measure the current.
} // particular motor. Any faster the motor stalls. M1 M2 M3 Mode(Excitation)
digitalWrite(dirpin, LOW); // Change direction. Standby mode (Operation of the
delay(100); OFF OFF OFF
internal circuit is almost turned off.)
for (i = 0; i<4000; i++) // Iterate for 4000 microsteps
OFF OFF ON 1/1 (2-phase excitation, full-step)
{
1/2A type (1-2 phase excitation A type) (
digitalWrite(steppin, LOW); // This LOW to HIGH change is what creates the OFF ON OFF
0% - 71% - 100% )
delayMicroseconds(400);
digitalWrite(steppin, HIGH); 1/2B type (1-2 phase excitation B type) (
OFF ON ON
delayMicroseconds(400); // This delay time is close to top speed for this 0% - 100% )
} // particular motor. Any faster the motor stalls. ON OFF OFF 1/4 (W1-2 phase excitation)
ON OFF ON 1/8 (2W1-2 phase excitation)
} ON ON OFF 1/16 (4W1-2 phase excitation)
Standby mode (Operation of the
ON ON ON
internal circuit is almost turned off.)