Arduino with TB6560 driver and stepper motor Nema 17 Hs4401

Аватар автора
Unix and the Magic of Love
Connection to arduino pin 9 (Step pin) to CLK+, pin 8 (Dir pin) to CW+, CLK- and CW- connect to GND arduino. Do not connect EN+ and EN- to any ARDUINO PIN. It only works for 1/8 step ( S3 and S4 on) and 1/16 step (S4 only on), half and full bridge does not work (for my case). Amp setting can be change according to the table on the DRIVER. int Distance = 0; // Record the number of steps we&taken void setup() { pinMode(8, OUTPUT); pinMode(9, OUTPUT); digitalWrite(8, LOW); digitalWrite(9, LOW); } void loop() { digitalWrite(9, HIGH); delayMicroseconds(100); digitalWrite(9, LOW); delayMicroseconds(100); Distance = Distance + 1; // record this step // Check to see if we are at the end of our move if (Distance == 3200) // two rotation for bridge { // We are! Reverse direction (invert DIR signal) if (digitalRead(8) == LOW) { digitalWrite(8, HIGH); } else { digitalWrite(8, LOW); } // Reset our distance back to zero since we're // starting a new move Distance = 0; // Now pause for half a second delay(500); } }

0/0


0/0

0/0

0/0