-
Notifications
You must be signed in to change notification settings - Fork 0
/
Testing.ino
87 lines (78 loc) · 1.7 KB
/
Testing.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
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
82
83
84
85
86
void toOrigin2()
{
while(y > 0 /*row limit switch is not pressed*/)
{
digitalWrite(2, HIGH); //decreases
digitalWrite(4, LOW); //decreases
digitalWrite(3, HIGH);
digitalWrite(5, HIGH);
delayMicroseconds(1000);
digitalWrite(3, LOW);
digitalWrite(5, LOW);
delayMicroseconds(1000);
y--;
}
while(x > 0/*column limit switch is not pressed*/)
{
digitalWrite(8, LOW); //decreases
digitalWrite(9, HIGH);
delayMicroseconds(1000);
digitalWrite(9, LOW);
delayMicroseconds(1000);
x--;
}
}
void testPixy()
{
int humanR = -1;
int humanC = -1;
humanC = map(pixy.blocks[0].x, 85, 240, 0, 3);
//left is 108,right is 108 mm
humanR = map(pixy.blocks[0].y, 22, 175, 0, 3);
Serial.println(humanR);
Serial.println(humanC);
}
void testRMotors()
{
/*for(int i = 0; i < 2100; i++) //left motor
{
digitalWrite(2, HIGH);
digitalWrite(4, LOW);
digitalWrite(3, HIGH);
digitalWrite(5, HIGH);
delayMicroseconds(1000);
digitalWrite(3, LOW);
digitalWrite(5, LOW);
delayMicroseconds(1000);
}*/
for(int i = 0; i < 2100; i++)
{
digitalWrite(2, LOW);
digitalWrite(4, HIGH);
digitalWrite(3, HIGH);
digitalWrite(5, HIGH);
delayMicroseconds(1000);
digitalWrite(3, LOW);
digitalWrite(5, LOW);
delayMicroseconds(1000);
}
}
void testCMotors()
{
for(int i = 0; i < 1700; i++)
{
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
delayMicroseconds(1000);
digitalWrite(9, LOW);
delayMicroseconds(1000);
}
/* for(int i = 0; i < 1700; i++)
{
digitalWrite(8, HIGH);
digitalWrite(9, HIGH);
delayMicroseconds(1000);
digitalWrite(9, LOW);
delayMicroseconds(1000);
}*/
}