@@ -11,6 +11,35 @@ void ProcessData()
11
11
{
12
12
13
13
PopulateArray ();
14
+
15
+ // initialize all motors and get them moving
16
+ for (int i = 0 ; i < NUMBER_MOTORS; i++)
17
+ {
18
+ if (motor_commands[i][1 ] == 0 )
19
+ {
20
+ my_servo[i].write (100 );
21
+ }
22
+ else if (motor_commands[i][1 ] == 1 )
23
+ {
24
+ my_servo[i].write (80 );
25
+ }
26
+ else if (motor_commands[i][1 ] == 2 )
27
+ {
28
+ my_servo[i].write (90 );
29
+ }
30
+ else if (motor_commands[i][1 ] == 3 )
31
+ {
32
+ // call reset function (still needs to be written)
33
+ }
34
+ else
35
+ {
36
+ // Sends Error Message
37
+ Invalid ();
38
+ }
39
+ }
40
+
41
+
42
+
14
43
//
15
44
/*
16
45
// Print First Number
@@ -72,28 +101,27 @@ void PopulateArray()
72
101
73
102
if (value1 == " Up" )
74
103
{
75
- motor_commands[i][1 ] = 0 ;
104
+ motor_commands[i][0 ] = 0 ;
76
105
}
77
106
else if (value1 == " Down" )
78
107
{
79
- motor_commands[i][1 ] = 1 ;
108
+ motor_commands[i][0 ] = 1 ;
80
109
}
81
-
82
110
else if (value1 == " None" )
83
111
{
84
- motor_commands[i][1 ] = 2 ;
112
+ motor_commands[i][0 ] = 2 ;
85
113
}
86
114
else if (value1 == " Reset" )
87
115
{
88
- motor_commands[i][1 ] = 3 ;
116
+ motor_commands[i][0 ] = 3 ;
89
117
}
90
118
else
91
119
{
92
120
// Sends Error Message
93
121
Invalid ();
94
122
}
95
123
96
- motor_commands[i][2 ] = value2.toInt ();
124
+ motor_commands[i][1 ] = value2.toInt ();
97
125
}
98
126
99
127
// print array
@@ -102,9 +130,9 @@ void PopulateArray()
102
130
Serial.print (" Motor Number: " );
103
131
Serial.print (i);
104
132
Serial.print (" - " );
105
- Serial.print (motor_commands[i][1 ]);
133
+ Serial.print (motor_commands[i][0 ]);
106
134
Serial.print (" - " );
107
- Serial.println (motor_commands[i][2 ]);
135
+ Serial.println (motor_commands[i][1 ]);
108
136
}
109
137
}
110
138
0 commit comments