-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDrivers.h
More file actions
81 lines (67 loc) · 1.95 KB
/
Copy pathDrivers.h
File metadata and controls
81 lines (67 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef DRIVERS
#define DRIVERS
//driver for the axis 1
#define PUL1_PIN 22
#define DIR1_PIN 23
//driver for the axis 2
#define PUL2_PIN 24
#define DIR2_PIN 25
//driver for the axis 3
#define PUL3_PIN 26
#define DIR3_PIN 27
//driver for the axis 4
#define PUL4_PIN 28
#define DIR4_PIN 29
//driver for the axis 5
#define PUL5_PIN A6
#define DIR5_PIN A7
//driver for the axis 6
#define PUL6_PIN A0
#define DIR6_PIN A1
//enable pin for the axis 3, 2 and 1
#define EN321_PIN 32
#define EN4_PIN A8
#define EN5_PIN A2
#define EN6_PIN 38
boolean PULstat1 = 0;
boolean PULstat2 = 0;
boolean PULstat3 = 0;
boolean PULstat4 = 0;
boolean PULstat5 = 0;
boolean PULstat6 = 0;
void setupDrivers() {
pinMode(PUL1_PIN, OUTPUT);
pinMode(DIR1_PIN, OUTPUT);
pinMode(PUL2_PIN, OUTPUT);
pinMode(DIR2_PIN, OUTPUT);
pinMode(PUL3_PIN, OUTPUT);
pinMode(DIR3_PIN, OUTPUT);
pinMode(PUL4_PIN, OUTPUT);
pinMode(DIR4_PIN, OUTPUT);
pinMode(PUL5_PIN, OUTPUT);
pinMode(DIR5_PIN, OUTPUT);
pinMode(PUL6_PIN, OUTPUT);
pinMode(DIR6_PIN, OUTPUT);
pinMode(EN321_PIN, OUTPUT);
pinMode(EN4_PIN, OUTPUT);
pinMode(EN5_PIN, OUTPUT);
pinMode(EN6_PIN, OUTPUT);
digitalWrite(PUL1_PIN, LOW); // gear ratio = 96/20 = 4.8
digitalWrite(DIR1_PIN, LOW); //LOW = negative direction
digitalWrite(PUL2_PIN, LOW); // gear ratio = 4
digitalWrite(DIR2_PIN, LOW); //LOW = positive direction
digitalWrite(PUL3_PIN, LOW); // gear ratio = 5
digitalWrite(DIR3_PIN, LOW); //LOW = negative direction
digitalWrite(PUL4_PIN, LOW); // gear ratio = 56/20 = 2.8
digitalWrite(DIR4_PIN, LOW); //LOW = positive direction
digitalWrite(PUL5_PIN, LOW); // gear ratio = 42/20 = 2.1
digitalWrite(DIR5_PIN, LOW); //LOW = positive direction
digitalWrite(PUL6_PIN, LOW); // gear ratio = 1
digitalWrite(DIR6_PIN, LOW); //LOW = positive direction
// all joints disabled!
digitalWrite(EN321_PIN, HIGH);
digitalWrite(EN4_PIN, HIGH);
digitalWrite(EN5_PIN, HIGH);
digitalWrite(EN6_PIN, HIGH);
}
#endif