forked from The-BoardWalkers/Automated-Chessboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmotor_code.ino
52 lines (41 loc) · 1.02 KB
/
motor_code.ino
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
#define motorXStep 2
#define motorYStep 3
#define motorZStep 4
#define motorAStep 12
#define motorXDir 5
#define motorYDir 6
#define motorZDir 7
#define motorADir 13
#define enableMotors 8
void setup()
{
pinMode(motorXStep, OUTPUT);
pinMode(motorYStep, OUTPUT);
pinMode(motorZStep, OUTPUT);
pinMode(motorAStep, OUTPUT);
pinMode(motorXDir, OUTPUT);
pinMode(motorYDir, OUTPUT);
pinMode(motorZDir, OUTPUT);
pinMode(motorADir, OUTPUT);
digitalWrite(8, LOW);
}
void loop()
{
digitalWrite(motorXDir, HIGH); // downwards -> LOW
digitalWrite(motorYDir, LOW); // left -> HIGH
digitalWrite(motorZDir, LOW); // downwards -> HIGH
digitalWrite(motorADir, HIGH);
for (int i = 0; i < 10000; i++)
{
digitalWrite(motorXStep, HIGH);
digitalWrite(motorYStep, HIGH);
digitalWrite(motorZStep, HIGH);
digitalWrite(motorAStep, HIGH);
digitalWrite(motorXStep, LOW);
digitalWrite(motorYStep, LOW);
digitalWrite(motorZStep, LOW);
digitalWrite(motorAStep, LOW);
delay(1);
}
delay(10000);
}