tb6600 stepper motor driver arduino code

Solutions on MaxInterview for tb6600 stepper motor driver arduino code by the best coders in the world

showing results for - "tb6600 stepper motor driver arduino code"
Amara
26 Jan 2017
1int PUL=7; //define Pulse pin
2int DIR=6; //define Direction pin
3int ENA=5; //define Enable Pin
4void setup() {
5  pinMode (PUL, OUTPUT);
6  pinMode (DIR, OUTPUT);
7  pinMode (ENA, OUTPUT);
8
9}
10
11void loop() {
12  for (int i=0; i<6400; i++)    //Forward 5000 steps
13  {
14    digitalWrite(DIR,LOW);
15    digitalWrite(ENA,HIGH);
16    digitalWrite(PUL,HIGH);
17    delayMicroseconds(50);
18    digitalWrite(PUL,LOW);
19    delayMicroseconds(50);
20  }
21  for (int i=0; i<6400; i++)   //Backward 5000 steps
22  {
23    digitalWrite(DIR,HIGH);
24    digitalWrite(ENA,HIGH);
25    digitalWrite(PUL,HIGH);
26    delayMicroseconds(50);
27    digitalWrite(PUL,LOW);
28    delayMicroseconds(50);
29  }
30}